[commit: packages/haskeline] master: MonadFix instance for InputT (13d2bd1)
git at git.haskell.org
git at git.haskell.org
Tue Dec 13 19:22:07 UTC 2016
Repository : ssh://git@git.haskell.org/haskeline
On branch : master
Link : http://git.haskell.org/packages/haskeline.git/commitdiff/13d2bd1d4bd02a89026f26ec02510e40b872ce34
>---------------------------------------------------------------
commit 13d2bd1d4bd02a89026f26ec02510e40b872ce34
Author: Alexander Vieth <alexander.vieth at mail.mcgill.ca>
Date: Tue Jun 21 18:16:37 2016 -0400
MonadFix instance for InputT
>---------------------------------------------------------------
13d2bd1d4bd02a89026f26ec02510e40b872ce34
System/Console/Haskeline/InputT.hs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/System/Console/Haskeline/InputT.hs b/System/Console/Haskeline/InputT.hs
index c1ee55e..1fcd4cc 100644
--- a/System/Console/Haskeline/InputT.hs
+++ b/System/Console/Haskeline/InputT.hs
@@ -15,6 +15,7 @@ import System.Directory(getHomeDirectory)
import System.FilePath
import Control.Applicative
import Control.Monad (liftM, ap)
+import Control.Monad.Fix
import System.IO
import Data.IORef
@@ -56,6 +57,9 @@ newtype InputT m a = InputT {unInputT ::
instance MonadTrans InputT where
lift = InputT . lift . lift . lift . lift . lift
+instance ( MonadFix m ) => MonadFix (InputT m) where
+ mfix f = InputT (mfix (unInputT . f))
+
-- | Get the current line input history.
getHistory :: MonadIO m => InputT m History
getHistory = InputT get
More information about the ghc-commits
mailing list