quox/tests/TypingImpls.idr

37 lines
789 B
Idris

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
%language ElabReflection
%runElab deriveIndexed "TyContext" [Show]
%runElab deriveIndexed "EqContext" [Show]
%runElab deriveIndexed "NameContexts" [Show]
%runElab derive "Error" [Show]
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 !(newRef 0)]
export
runTC : Definitions -> Eff TC a -> Either Error a
runTC = runEqual