-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
53ccd4b
commit 649af6a
Showing
5 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module Eta.Classes.MonadTrans | ||
( {-| | ||
A Monad Transformer is a typeclass that | ||
allows to execute functions of one Monad | ||
inside of another by providing a 'lift' | ||
operation: | ||
@ | ||
wontWork :: Maybe (IO Int) | ||
wontWork = do | ||
someString <- getLine -- Compile error: getLine returns an IO action, not Maybe | ||
if someString == "" | ||
then Nothing | ||
else length someString |> Just | ||
ok :: MaybeT IO Int | ||
ok = do | ||
someString <- lift getLine | ||
if someString == "" | ||
then Nothing | ||
else length someString |> Just | ||
@ | ||
There are quite a lot of transformers available: | ||
* ExceptT | ||
* IdentityT | ||
* MaybeT | ||
* ReaderT | ||
* StateT | ||
* WriterT | ||
-} | ||
module Control.Monad.Trans.Class | ||
, module Exported | ||
) | ||
where | ||
|
||
import Control.Monad.Trans.Class | ||
|
||
import Control.Monad.Trans.Except as Exported hiding (liftCallCC, liftListen, liftPass, liftCatch) | ||
import Control.Monad.Trans.Identity as Exported hiding (liftCallCC, liftListen, liftPass, liftCatch) | ||
import Control.Monad.Trans.Maybe as Exported hiding (liftCallCC, liftListen, liftPass, liftCatch) | ||
import Control.Monad.Trans.Reader as Exported hiding (liftCallCC, liftListen, liftPass, liftCatch) | ||
import Control.Monad.Trans.State as Exported hiding (liftCallCC, liftListen, liftPass, liftCatch) | ||
import Control.Monad.Trans.Writer as Exported hiding (liftCallCC, liftListen, liftPass, liftCatch) |