mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-28 11:05:17 +03:00
[ base ] Implement MonadError ()
for MaybeT
This commit is contained in:
parent
6891490ed2
commit
5266a2bc22
@ -74,6 +74,11 @@ MonadError () Maybe where
|
||||
catchError Nothing f = f ()
|
||||
catchError x _ = x
|
||||
|
||||
public export
|
||||
Monad m => MonadError () (MaybeT m) where
|
||||
throwError () = MkMaybeT $ pure Nothing
|
||||
catchError (MkMaybeT m) f = MkMaybeT $ m >>= maybe (runMaybeT $ f ()) (pure @{Compose})
|
||||
|
||||
public export
|
||||
MonadError e (Either e) where
|
||||
throwError = Left
|
||||
|
Loading…
Reference in New Issue
Block a user