[Haskell-beginners] Monad for Pair
mike_k_houghton at yahoo.co.uk
Tue Nov 17 21:41:20 UTC 2015
newtype Pair a = P (a, a) deriving (Show)
and have made Monoid, Applicative and Functor instances for it.
I’m a bit stumped with Monad!
instance Monad Pair where
return x = P (x, x)
and I got brain ache with >>=
And really return x = P (x, x)
doesn’t seem correct anyway.
Would someone please write the Monad with an explanation?
More information about the Beginners