Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created August 19, 2015 11:43
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 shigemk2/7b75e024296311328b35 to your computer and use it in GitHub Desktop.
Save shigemk2/7b75e024296311328b35 to your computer and use it in GitHub Desktop.
import Data.Monoid
-- instance Monoid [a] where
-- mempty = []
-- mappend = (++)
main = do
print $ [1,2,3] `mappend` [4,5,6]
print $ ("one" `mappend` "two") `mappend` "tree"
print $ "one" `mappend` ("two" `mappend` "tree")
print $ "one" `mappend` "two" `mappend` "tree"
print $ "pang" `mappend` mempty
print $ mconcat [[1,2],[3,6],[9]]
-- print $ mempty :: [a]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment