Add a MonadRec instance to UnifyT

This commit is contained in:
Danila Fedorin 2023-03-12 21:05:03 -07:00
parent 590306964c
commit ef3dabfa22
2 changed files with 3 additions and 0 deletions

View File

@ -19,6 +19,7 @@ to generate this file without the comments in this block.
, "newtype"
, "ordered-collections"
, "prelude"
, "tailrec"
, "transformers"
, "tuples"
]

View File

@ -4,6 +4,7 @@ import Prelude (($), (<<<), const, flip, unit)
import Control.Plus (class Plus)
import Control.Monad (class Monad)
import Control.Monad.Rec.Class (class MonadRec)
import Control.Monad.State.Trans (StateT, runStateT)
import Control.Monad.State.Class (gets, modify)
import Control.Monad.Unify.Class (class MonadUnify, class Unifiable, class UnificationVariable, Stream, pop, squash, variable, variables, reify, unify)
@ -41,6 +42,7 @@ derive newtype instance (Monad m, Alt m) => Alt (UnifyT k f m)
derive newtype instance (Monad m, Plus m) => Plus (UnifyT k f m)
instance (Monad m, Alternative m) => Alternative (UnifyT k f m)
instance (MonadPlus m) => MonadPlus (UnifyT k f m)
derive newtype instance MonadRec m => MonadRec (UnifyT k f m)
instance (Unifiable k f, MonadPlus m) => MonadUnify k f (UnifyT k f m) where
fresh = MkUnifyT $ do