some of this EffExtra stuff doesn't work

This commit is contained in:
rhiannon morris 2023-10-21 20:48:28 +02:00
parent 3683aec7be
commit 49bc1d5b02
2 changed files with 5 additions and 25 deletions

View File

@ -69,17 +69,6 @@ subsetTail : Length xs => (0 x : a) -> Subset xs (x :: xs)
subsetTail _ = subsetWith S subsetTail _ = subsetWith S
export
catchMaybeAt : (0 lbl : tag) -> (Has (ExceptL lbl e) fs, Length fs) =>
(e -> Eff fs a) -> Eff fs a -> Eff fs a
catchMaybeAt lbl hnd act =
catchAt lbl hnd $ lift @{subsetTail $ ExceptL lbl e} act
export %inline
catchMaybe : (Has (Except e) fs, Length fs) =>
(e -> Eff fs a) -> Eff fs a -> Eff fs a
catchMaybe = catchMaybeAt ()
export export
rethrowAtWith : (0 lbl : tag) -> Has (ExceptL lbl e') fs => rethrowAtWith : (0 lbl : tag) -> Has (ExceptL lbl e') fs =>
@ -91,22 +80,13 @@ rethrowWith : Has (Except e') fs => (e -> e') -> Either e a -> Eff fs a
rethrowWith = rethrowAtWith () rethrowWith = rethrowAtWith ()
export export
wrapErr' : Length fs => (e -> e') -> wrapErr : Length fs => (e -> e') ->
Eff (ExceptL lbl e :: fs) a -> Eff (ExceptL lbl e :: fs) a ->
Eff (ExceptL lbl e' :: fs) a Eff (ExceptL lbl e' :: fs) a
wrapErr' f act = wrapErr f act =
catchAt lbl (throwAt lbl . f) @{S Z} $ catchAt lbl (throwAt lbl . f) @{S Z} $
lift @{subsetTail _} act lift @{subsetTail _} act
export
wrapErrAt : (0 lbl : tag) -> (Has (ExceptL lbl e) fs, Length fs) =>
(e -> e) -> Eff fs a -> Eff fs a
wrapErrAt lbl wrap = catchMaybeAt lbl (\ex => throwAt lbl $ wrap ex)
export %inline
wrapErr : (Has (Except e) fs, Length fs) => (e -> e) -> Eff fs a -> Eff fs a
wrapErr = wrapErrAt ()
export export
handleExcept : Functor m => (forall c. e -> m c) -> ExceptL lbl e a -> m a handleExcept : Functor m => (forall c. e -> m c) -> ExceptL lbl e a -> m a

View File

@ -87,7 +87,7 @@ Erase = [Except Error, DefsReader, NameGen]
export export
liftWhnf : Eff Whnf a -> Eff Erase a liftWhnf : Eff Whnf a -> Eff Erase a
liftWhnf act = lift $ wrapErr' WrapTypeError act liftWhnf act = lift $ wrapErr WrapTypeError act
export covering export covering
computeElimType : ErasureContext d n -> SQty -> Elim d n -> Eff Erase (Term d n) computeElimType : ErasureContext d n -> SQty -> Elim d n -> Eff Erase (Term d n)