Skip to content

Instantly share code, notes, and snippets.

@mvolkmann
Created January 6, 2018 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvolkmann/a4f5d5bb6a796828e04efd6816d5d44a to your computer and use it in GitHub Desktop.
Save mvolkmann/a4f5d5bb6a796828e04efd6816d5d44a to your computer and use it in GitHub Desktop.
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