on master help sign in
Deprecate flatten.
commitbdeaed6f84573ebfc1cf9f6513d405a2af329edd authorMatus Tejiscak <ziman@functor.sk> dateFri 12 Feb 2016, 10:19 (11 years ago) parent0544ce9
2 files changed+6−1
libs/prelude/Prelude/Monad.idr+5−1 libs/prelude/Prelude/Providers.idr+1
libs/prelude/Prelude/Monad.idr+5−1
@@ -21,13 +21,17 @@ interface Applicative m => Monad (m : Type -> Type) where
2121
2222 -- default implementations
2323 (>>=) x f = join (f <$> x)
24− join x = x >>= (\y => y)
24+ join x = x >>= id
2525
2626||| For compatibility with Haskell. Note that monads are **not** free to
2727||| define `return` and `pure` differently!
2828return : Monad m => a -> m a
2929return = pure
3030
31+flatten : Monad m => m (m a) -> m a
32+flatten = join
33+%deprecate flatten "Please use `join`, which is the standard name."
34+
3135-- Annoyingly, these need to be here, so that we can use them in other
3236-- Prelude modules other than the top level.
3337
libs/prelude/Prelude/Providers.idr+1
@@ -1,5 +1,6 @@
11module Prelude.Providers
22
3+import Prelude.Basics
34import Prelude.Functor
45import Prelude.Applicative
56import Prelude.Monad