Skip to content

Commit adef436

Browse files
quasicomputationaljudah
authored andcommitted
Add a MonadFail instance for InputT. (#117)
There are also a couple of other monads that could plausibly have this instance, but since none of them seem to be exported I left them alone.
1 parent eb18908 commit adef436

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Changelog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Next
2+
* Added a `MonadFail` instance for `InputT`.
3+
14
Changed in version 0.7.5.0:
25
* Add the new function `fallbackCompletion` to combine
36
multiple `CompletionFunc`s

System/Console/Haskeline/InputT.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import System.Console.Haskeline.Term
1313

1414
import Control.Exception (IOException)
1515
import Control.Monad.Catch
16+
import Control.Monad.Fail as Fail
1617
import Control.Monad.Fix
1718
import Data.IORef
1819
import System.Directory(getHomeDirectory)
@@ -58,6 +59,9 @@ newtype InputT m a = InputT {unInputT ::
5859
instance MonadTrans InputT where
5960
lift = InputT . lift . lift . lift . lift . lift
6061

62+
instance ( Fail.MonadFail m ) => Fail.MonadFail (InputT m) where
63+
fail = lift . Fail.fail
64+
6165
instance ( MonadFix m ) => MonadFix (InputT m) where
6266
mfix f = InputT (mfix (unInputT . f))
6367

0 commit comments

Comments
 (0)