quox/tests/TypingImpls.idr

38 lines
789 B
Idris
Raw Normal View History

2023-02-11 12:15:50 -05:00
module TypingImpls
import TAP
import public Quox.Typing
import public Quox.Pretty
2023-08-25 12:09:06 -04:00
import Quox.Equal
import Quox.Typechecker
import Quox.ST
2023-05-14 13:58:46 -04:00
import PrettyExtra
2023-02-11 12:15:50 -05:00
2023-03-13 14:33:09 -04:00
import Derive.Prelude
%language ElabReflection
2023-04-01 13:16:43 -04:00
%runElab deriveIndexed "TyContext" [Show]
%runElab deriveIndexed "EqContext" [Show]
2023-04-15 09:13:01 -04:00
%runElab deriveIndexed "NameContexts" [Show]
2023-04-01 13:16:43 -04:00
%runElab derive "Error" [Show]
2023-02-11 12:15:50 -05:00
export
2023-05-14 13:58:46 -04:00
ToInfo Error where
toInfo err =
let str = render (Opts 60) $ runPrettyDef $ prettyError True err in
[("err", str)]
2023-08-25 12:09:06 -04:00
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