5 Jan
2006
5 Jan
'06
7:54 p.m.
On 05/01/06, Taral <taralx@gmail.com> wrote:
On 1/5/06, Cale Gibbard <cgibbard@gmail.com> wrote:
class Applicative m => Monad m where m >>= f = join (map f m)
instance PointedFunctor m where require return map f x = x >>= (return . f)
Um, it looks like map and (>>=) are recursive...
The intent is that this is similar to other default method declarations which aren't really recursive, though they may look like it.
From the Ord class in the Prelude, we have:
compare x y | x == y = EQ | x <= y = LT | otherwise = GT x <= y = compare x y /= GT .... Which looks recursive, but it's not, because the user is required to provide one of the two. - Cale