Skip to content

Commit

Permalink
support for qualified do
Browse files Browse the repository at this point in the history
support for qualified do notation
  • Loading branch information
echatav committed Oct 7, 2020
1 parent c7799a8 commit 63e0132
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions indexed-transformers.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ library
exposed-modules:
Control.Monad.Trans.Indexed
Control.Monad.Trans.Indexed.Cont
Control.Monad.Trans.Indexed.Do
Control.Monad.Trans.Indexed.Free
Control.Monad.Trans.Indexed.Free.Fold
Control.Monad.Trans.Indexed.Free.Lance
Expand Down
35 changes: 35 additions & 0 deletions src/Control/Monad/Trans/Indexed/Do.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{-# LANGUAGE
GADTs
, NoImplicitPrelude
#-}

module Control.Monad.Trans.Indexed.Do
( (>>=)
, (>>)
, fail
) where

import qualified Control.Monad as M
import qualified Control.Monad.Trans as T
import qualified Control.Monad.Trans.Indexed as Ix
import qualified Prelude as P

(>>=)
:: (Ix.IndexedMonadTrans t, M.Monad m)
=> t i j m x
-> (x -> t j k m y)
-> t i k m y
(>>=) = P.flip Ix.ixBind

(>>)
:: (Ix.IndexedMonadTrans t, M.Monad m)
=> t i j m x
-> t j k m y
-> t i k m y
(>>) = P.flip Ix.ixThen

fail
:: (Ix.IndexedMonadTrans t, M.MonadFail m, i ~ j)
=> P.String
-> t i j m x
fail = T.lift P.. M.fail

0 comments on commit 63e0132

Please sign in to comment.