Short (72 chars or less) summary
More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).
Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
This file contains hidden or 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
import Data.Foldable (foldl') | |
import Debug.Trace (trace) | |
prnEqual :: (Eq a) => a -> a -> IO () | |
prnEqual a b = if a == b then print "True" else print "False" | |
-- Note the absence of parentheses around `Eq a` and having exactly one `print`. | |
prnEqual' :: Eq a => a -> a -> IO () | |
prnEqual' a b = print $ if a == b then "True" else "False" |
This file contains hidden or 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
{-- XXX Your definition of `checkChar` is okay, but the abstraction itself | |
-- is very odd. It is fine as an exercise of using "do" notation and | |
-- `return`. In real code though explicit statements are both short and | |
-- expressive (see lines 21-22). | |
checkChar :: IO Bool | |
checkChar = do | |
c <- getChar | |
return (c == 'y') | |
--} |
This file contains hidden or 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
listsum :: Num a => [a] -> a | |
listsum [] = 0 | |
listsum (x:xs) = x + listsum xs | |
main :: IO () | |
main = print $ listsum [1..5] |