Created
August 19, 2015 12:12
-
-
Save shigemk2/176cb68110565d0ab65a to your computer and use it in GitHub Desktop.
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.Monoid | |
main = do | |
print $ Nothing `mappend` Just "andy" | |
print $ Just LT `mappend` Nothing | |
print $ Just (Sum 3) `mappend` Just (Sum 4) | |
print $ getFirst $ First (Just 'a') `mappend` First (Just 'b') | |
print $ getFirst $ First Nothing `mappend` First (Just 'b') | |
print $ getFirst $ First (Just 'a') `mappend` First Nothing | |
print $ getFirst . mconcat . map First $ [Nothing, Just 9, Just 10] | |
print $ getLast . mconcat . map Last $ [Nothing, Just 9, Just 10] | |
print $ getLast $ Last (Just "one") `mappend` Last (Just "two") | |
-- 先のほうの引数を優先 | |
print $ First (Just "one") `mappend` First (Just "two") | |
-- 後のほうの引数を優先 | |
print $ Last (Just "one") `mappend` Last (Just "two") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment