quox/tests/TypingImpls.idr

34 lines
704 B
Idris
Raw Permalink Normal View History

2023-02-11 18:15:50 +01:00
module TypingImpls
import TAP
import public Quox.Typing
import public Quox.Pretty
2023-08-25 18:09:06 +02:00
import Quox.Equal
import Quox.Typechecker
2023-09-19 00:41:47 +02:00
import Control.Monad.ST.Extra
2023-05-14 19:58:46 +02:00
import PrettyExtra
2023-02-11 18:15:50 +01:00
2023-03-13 19:33:09 +01:00
import Derive.Prelude
%language ElabReflection
2023-02-11 18:15:50 +01:00
export
2023-05-14 19:58:46 +02:00
ToInfo Error where
toInfo err =
let str = render (Opts 60) $ runPrettyDef $ prettyError True err in
[("err", str)]
2023-08-25 18:09:06 +02:00
export
runEqual : Definitions -> Eff Equal a -> Either Error a
runEqual defs act = runSTErr $ do
2024-04-04 19:23:08 +02:00
runEff act $ with Union.(::)
2023-08-25 18:09:06 +02:00
[handleExcept (\e => stLeft e),
handleReaderConst defs,
handleStateSTRef !(newSTRef' 0),
handleLogDiscardST !(newSTRef' 0)]
2023-08-25 18:09:06 +02:00
export
runTC : Definitions -> Eff TC a -> Either Error a
runTC = runEqual