whikng
Last Updated: February 25, 2018
·
64
· maciejsmolinski

Haskell - Functors in GHCi

Running :i Functor in ghci yields the following:

class Functor (f :: * -> *) where
  fmap :: (a -> b) -> f a -> f b
  (<$) :: a -> f b -> f a

Plus it lists available instances of the Functor typeclass:

instance Functor (Either a) -- Defined in ‘Data.Either’
instance Functor [] -- Defined in ‘GHC.Base’
instance Functor Maybe -- Defined in ‘GHC.Base’
instance Functor IO -- Defined in ‘GHC.Base’
instance Functor ((->) r) -- Defined in ‘GHC.Base’
instance Functor ((,) a) -- Defined in ‘GHC.Base’

More information on functors: http://notes.maciejsmolinski.com/2018/02/16/functors-by-example/