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

@ -3,6 +3,9 @@ module TypingImpls
import TAP
import public Quox.Typing
import public Quox.Pretty
import Quox.Equal
import Quox.Typechecker
import Quox.ST
import PrettyExtra
import Derive.Prelude
@ -19,3 +22,16 @@ ToInfo Error where
toInfo err =
let str = render (Opts 60) $ runPrettyDef $ prettyError True err in
[("err", str)]
export
runEqual : Definitions -> Eff Equal a -> Either Error a
runEqual defs act = runSTErr $ do
runEff act
[handleExcept (\e => stLeft e),
handleReaderConst defs,
handleStateSTRef !(newRef 0)]
export
runTC : Definitions -> Eff TC a -> Either Error a
runTC = runEqual