on 585ca71 help sign in
CHANGELOG.md+5
since splitsnapshots
unifiedsplit
@@ -1,3 +1,8 @@
1+0.4.2.0
2+-------
3+
4+* Add default MTL instances for DispatchT.
5+
10.4.1.0
60.4.1.0
2-------
7-------
3
8
ether.cabal+1−1
@@ -1,5 +1,5 @@
1name: ether
1name: ether
2−version: 0.4.1.0
2+version: 0.4.2.0
3synopsis: Monad transformers and classes
3synopsis: Monad transformers and classes
4description:
4description:
5 Ether is a Haskell library that extends @mtl@ and @transformers@ with
5 Ether is a Haskell library that extends @mtl@ and @transformers@ with
src/Control/Monad/Trans/Ether/Dispatch.hs+47
@@ -1,5 +1,10 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2
2
3+#if __GLASGOW_HASKELL__ < 710
4+{-# LANGUAGE OverlappingInstances #-}
5+{-# OPTIONS_GHC -fno-warn-unrecognised-pragmas #-}
6+#endif
7+
3#if __GLASGOW_HASKELL__ >= 710
8#if __GLASGOW_HASKELL__ >= 710
4{-# OPTIONS_GHC -fno-warn-unticked-promoted-constructors #-}
9{-# OPTIONS_GHC -fno-warn-unticked-promoted-constructors #-}
5#endif
10#endif
@@ -84,6 +89,7 @@ import Control.Monad.Ether.State.Class
84import Control.Monad.Ether.Except.Class
89import Control.Monad.Ether.Except.Class
85import Control.Monad.Ether.Writer.Class
90import Control.Monad.Ether.Writer.Class
86
91
92+import qualified Control.Monad.Cont as Class
87import qualified Control.Monad.Reader as Class
93import qualified Control.Monad.Reader as Class
88import qualified Control.Monad.State as Class
94import qualified Control.Monad.State as Class
89import qualified Control.Monad.Except as Class
95import qualified Control.Monad.Except as Class
@@ -207,3 +213,44 @@ instance MonadWriter tNew w m
207 tell _ = let t = Proxy :: Proxy tNew in Lift.lift . tell t
213 tell _ = let t = Proxy :: Proxy tNew in Lift.lift . tell t
208 listen _ = let t = Proxy :: Proxy tNew in Lift.liftListen (listen t)
214 listen _ = let t = Proxy :: Proxy tNew in Lift.liftListen (listen t)
209 pass _ = let t = Proxy :: Proxy tNew in Lift.liftPass (pass t)
215 pass _ = let t = Proxy :: Proxy tNew in Lift.liftPass (pass t)
216+
217+
218+-- Instances for mtl classes
219+
220+instance {-# OVERLAPPABLE #-}
221+ ( Class.MonadCont m
222+ ) => Class.MonadCont (DispatchT dp m)
223+ where
224+ callCC = Lift.liftCallCC' Class.callCC
225+
226+instance {-# OVERLAPPABLE #-}
227+ ( Class.MonadReader r m
228+ ) => Class.MonadReader r (DispatchT dp m)
229+ where
230+ ask = Class.lift Class.ask
231+ local = Lift.liftLocal Class.ask Class.local
232+ reader = Class.lift . Class.reader
233+
234+instance {-# OVERLAPPABLE #-}
235+ ( Class.MonadState s m
236+ ) => Class.MonadState s (DispatchT dp m)
237+ where
238+ get = Class.lift Class.get
239+ put = Class.lift . Class.put
240+ state = Class.lift . Class.state
241+
242+instance {-# OVERLAPPABLE #-}
243+ ( Class.MonadWriter w m
244+ ) => Class.MonadWriter w (DispatchT dp m)
245+ where
246+ writer = Class.lift . Class.writer
247+ tell = Class.lift . Class.tell
248+ listen = Lift.liftListen Class.listen
249+ pass = Lift.liftPass Class.pass
250+
251+instance {-# OVERLAPPABLE #-}
252+ ( Class.MonadError e m
253+ ) => Class.MonadError e (DispatchT dp m)
254+ where
255+ throwError = Class.lift . Class.throwError
256+ catchError = Lift.liftCatch Class.catchError