It is probably a bad idea in #Haskell,
but still surprising: #ghc does not
complain about using "do" to define (>>=) itself.
It seams to cause and endless loop.
newtype BadIdea a = B a
deriving Show
instance Functor BadIdea where
fmap f (B a) = B (f a)
instance Applicative BadIdea where
pure x = B x
(B f) <*> B x = B (f x)
instance Monad BadIdea where
return x = B x
ma >>= f = do
a <- ma
f a
-- instead of
-- (B a) >>= f = f a
main = print
(B 5 >>= (\x -> B (2*x)))