mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-18 08:42:11 +03:00
15 lines
305 B
Idris
15 lines
305 B
Idris
public export
|
|
interface Do (0 m : Type) where
|
|
Next : m -> Type
|
|
bind : (x : m) -> Next x
|
|
|
|
public export
|
|
Monad m => Do (m a) where
|
|
Next x = {b : Type} -> (a -> m b) -> m b
|
|
bind x k = x >>= k
|
|
|
|
foo : Maybe Int -> Maybe Int -> Maybe Int
|
|
foo x y
|
|
= bind x (\x' =>
|
|
bind y (\y' => Just (x' + y')))
|