Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created March 12, 2015 15:40
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/5adfa4b0a861de6c447d to your computer and use it in GitHub Desktop.
Save shigemk2/5adfa4b0a861de6c447d to your computer and use it in GitHub Desktop.
src = [1..5]
-- 引数は省略してもよい(足りない引数は自動的に補う)
test1 f = flip map src f
test1' = flip map src
test2 f = (`map` [1..5]) f
test2' = (`map` [1..5])
-- ここの引数は省略できない
test3 f = map f src
test4 = map (* 2) src
test5 = flip map src (* 2)
test6 = flip map src $ \x -> x * 2
main = do
print $ test1 (* 2)
print $ test1' (* 2)
print $ test2 (* 2)
print $ test2' (* 2)
print $ test3 (* 2)
print $ test4
print $ test5
print $ test6
print $ flip map src (* 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment