Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
Remove instance PluckError e (Except e) m
Browse files Browse the repository at this point in the history
The presence of this instance causes overlapping instance errors when
trying to hoist `ExceptT e m a` values for unknown `m`.

`Except e` is an alias for `ExceptT e Identity`, is isomorphic to
`Either e`, and I don't think I've ever seen it in production code.
  • Loading branch information
endgame committed May 6, 2024
1 parent a18cf8d commit 074b57e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Replaced the `HoistError` typeclass, which is about monads, with a
simpler `PluckError` typeclass that is about extracting errors from
values.
* Removed the instance for `Except e`, as it triggers overlapping
instance errors when attempting to hoist `ExceptT e m` for unknown
monads `m`.
* Introduced a parallel `Control.Monad.Fail.Hoist` module, for
hoisting error messages into `MonadFail`.

Expand Down
4 changes: 0 additions & 4 deletions src/Control/Monad/Error/Hoist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,3 @@ instance Applicative m => PluckError e (Either e) m where
instance Monad m => PluckError e (ExceptT e m) m where
pluckError = runExceptT
foldError f g = either f g <=< runExceptT

instance Applicative m => PluckError e (Except e) m where
pluckError = pure . runExcept
foldError f g = either f g . runExcept

0 comments on commit 074b57e

Please sign in to comment.