[Haskell-beginners] Functor fmap: how to

Imants Cekusins imantc at gmail.com
Thu Jun 25 19:44:29 UTC 2015


as the author just realized :-P, we can fmap (a -> b), too


module FunctorAb where


-- (a -> b)
overTen:: Int -> Bool
overTen x
   | x > 10 = True
   | otherwise = False


-- maybe
maybe1::Maybe Int -> Maybe Bool
maybe1 mi = overTen <$> mi


--  list
list1::[Int] -> [Bool]
list1 l = overTen <$> l


More information about the Beginners mailing list