@@ -21,13 +21,17 @@ interface Applicative m => Monad (m : Type -> Type) where
22 -- default implementations
22 -- default implementations
23 (>>=) x f = join (f <$> x)
23 (>>=) x f = join (f <$> x)
24− join x = x >>= (\y => y)
24+ join x = x >>= id
26||| For compatibility with Haskell. Note that monads are **not** free to
26||| For compatibility with Haskell. Note that monads are **not** free to
27||| define `return` and `pure` differently!
27||| define `return` and `pure` differently!
28return : Monad m => a -> m a
28return : Monad m => a -> m a
29return = pure
29return = pure
31+flatten : Monad m => m (m a) -> m a
33+%deprecate flatten "Please use `join`, which is the standard name."
31-- Annoyingly, these need to be here, so that we can use them in other
35-- Annoyingly, these need to be here, so that we can use them in other
32-- Prelude modules other than the top level.
36-- Prelude modules other than the top level.