Created
January 6, 2018 16:41
-
-
Save mvolkmann/a4f5d5bb6a796828e04efd6816d5d44a to your computer and use it in GitHub Desktop.
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
instance LogType (IO a) where | |
logn' arr = do | |
-- Call putStr on all the elements in arr. | |
mapM_ putStr arr -- functions that end in _ ignore their result | |
-- Output a newline. | |
putStrLn "" | |
-- The "do" block must return something. | |
return undefined | |
instance (Show a, LogType r) => LogType (a -> r) where | |
logn' arr x = logn' (arr ++ [show x] ++ [" "]) | |
logn :: (LogType t) => t -- Why doesn't () work in place of the last t? | |
logn = logn' [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment