quox/tests/TypingImpls.idr
2023-09-19 13:05:01 +02:00

32 lines
654 B
Idris

module TypingImpls
import TAP
import public Quox.Typing
import public Quox.Pretty
import Quox.Equal
import Quox.Typechecker
import Control.Monad.ST.Extra
import PrettyExtra
import Derive.Prelude
%language ElabReflection
export
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 !(liftST $ newSTRef 0)]
export
runTC : Definitions -> Eff TC a -> Either Error a
runTC = runEqual