Add MonadUnify instance for the state monad.
This commit is contained in:
parent
d1e227dbed
commit
1f93dc1745
@ -5,6 +5,8 @@ import Prelude (Unit, unit, ($))
|
||||
import Control.Applicative (pure)
|
||||
import Control.Bind (bind)
|
||||
import Control.MonadPlus (class MonadPlus, empty)
|
||||
import Control.Monad.State.Trans (StateT)
|
||||
import Control.Monad.Trans.Class (lift)
|
||||
import Data.Traversable (class Traversable, traverse)
|
||||
import Data.Tuple (Tuple(..))
|
||||
import Data.Lazy (Lazy, force)
|
||||
@ -43,3 +45,9 @@ unify f1 f2 =
|
||||
process (Merge k1 k2) = merge k1 k2
|
||||
process (Store k f) = store k f
|
||||
process Fail = empty
|
||||
|
||||
instance MonadUnify k f m => MonadUnify k f (StateT s m) where
|
||||
fresh = lift fresh
|
||||
merge m k = lift $ merge m k
|
||||
store k f = lift $ store k f
|
||||
reify f = lift $ reify f
|
||||
|
Loading…
Reference in New Issue
Block a user