fzw4zw
Last Updated: February 25, 2018
·
71
· maciejsmolinski

Haskell - Monads in GHCi

Running :i Monad in ghci yields the following:

class Applicative m => Monad (m :: * -> *) where
  (>>=) :: m a -> (a -> m b) -> m b
  (>>) :: m a -> m b -> m b
  return :: a -> m a
  fail :: String -> m a

Plus it lists available instances of the Monad typeclass:

instance Monad m => Monad (WrappedMonad m)
  -- Defined in ‘Control.Applicative’
instance Monad (Either e) -- Defined in ‘Data.Either’
instance Monad [] -- Defined in ‘GHC.Base’
instance Monad Maybe -- Defined in ‘GHC.Base’
instance Monad IO -- Defined in ‘GHC.Base’
instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’

More information on monads: http://notes.maciejsmolinski.com/2018/02/18/monads-by-example/