forked from cyga/real-world-haskell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix order for chunks, add newline as chunks separator
- Loading branch information
Showing
127 changed files
with
3,866 additions
and
2,714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
-- file: ch02/myDrop.hs | ||
niceDrop n xs | n <= 0 = xs | ||
niceDrop _ [] = [] | ||
niceDrop n (_:xs) = niceDrop (n - 1) xs-- file: ch02/myDrop.hs | ||
myDrop n xs = if n <= 0 || null xs | ||
then xs | ||
else myDrop (n - 1) (tail xs) | ||
|
||
-- file: ch02/myDrop.hs | ||
niceDrop n xs | n <= 0 = xs | ||
niceDrop _ [] = [] | ||
niceDrop n (_:xs) = niceDrop (n - 1) xs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
-- file: ch03/BadPattern.hs | ||
goodExample (x:xs) = x + goodExample xs | ||
goodExample _ = 0-- file: ch03/BadPattern.hs | ||
badExample (x:xs) = x + badExample xs | ||
|
||
-- file: ch03/BadPattern.hs | ||
goodExample (x:xs) = x + goodExample xs | ||
goodExample _ = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
-- file: ch03/BadTree.hs | ||
nodesAreSame (Node a _ _) (Node b _ _) | ||
| a == b = Just a | ||
nodesAreSame _ _ = Nothing-- file: ch03/BadTree.hs | ||
bad_nodesAreSame (Node a _ _) (Node a _ _) = Just a | ||
bad_nodesAreSame _ _ = Nothing | ||
|
||
-- file: ch03/BadTree.hs | ||
nodesAreSame (Node a _ _) (Node b _ _) | ||
| a == b = Just a | ||
nodesAreSame _ _ = Nothing |
Oops, something went wrong.