loading
open in
main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
addOne :: Num a => a -> a
addOne a = a + 1

main = do
  print $ fmap addOne [ ]
  print $ fmap addOne [1]
  print $ fmap addOne [1, 2, 3]
  
  print $ fmap addOne (Nothing)
  print $ fmap addOne (Just 2)
  
  print $ fmap addOne (Left  0 :: Either Int Int)
  print $ fmap addOne (Right 2 :: Either Int Int)
GHCi, version 8.0.1