more effect stuff, incl. ST

This commit is contained in:
rhiannon morris 2023-08-25 18:09:06 +02:00
parent 4b6b3853a1
commit a221380d61
17 changed files with 395 additions and 204 deletions

View file

@ -20,33 +20,6 @@ public export
EqualInner : List (Type -> Type)
EqualInner = [ErrorEff, NameGen, EqModeState]
export
runEqualWith_ : EqMode -> NameSuf ->
Eff EqualInner a -> (Either Error a, NameSuf)
runEqualWith_ mode suf act =
extract $
runNameGenWith suf $
runExcept $
evalState mode act
export
runEqualInner : EqMode -> Eff EqualInner a -> Either Error a
runEqualInner mode act = fst $ runEqualWith_ mode 0 act
export
runEqualWith : NameSuf -> Definitions ->
Eff Equal a -> (Either Error a, NameSuf)
runEqualWith suf defs act =
extract $
runStateAt GEN suf $
runReaderAt DEFS defs $
runExcept act
export
runEqual : Definitions -> Eff Equal a -> Either Error a
runEqual defs act = fst $ runEqualWith 0 defs act
export %inline
mode : Has EqModeState fs => Eff fs EqMode
@ -631,7 +604,7 @@ parameters (loc : Loc) (ctx : TyContext d n)
parameters (mode : EqMode)
private
fromInner : Eff EqualInner a -> Eff Equal a
fromInner act = lift $ evalState mode act
fromInner = lift . map fst . runState mode
private
eachFace : Applicative f => (EqContext n -> DSubst d 0 -> f ()) -> f ()