quox/tests/TypingImpls.idr

66 lines
1.9 KiB
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
export
PrettyHL q => ToInfo (Error q) where
toInfo (NotInScope x) =
[("type", "NotInScope"),
("name", show x)]
toInfo (ExpectedTYPE t) =
[("type", "ExpectedTYPE"),
2023-02-19 11:54:39 -05:00
("got", prettyStr True t)]
2023-02-11 12:15:50 -05:00
toInfo (ExpectedPi t) =
[("type", "ExpectedPi"),
2023-02-19 11:54:39 -05:00
("got", prettyStr True t)]
2023-02-11 12:15:50 -05:00
toInfo (ExpectedSig t) =
[("type", "ExpectedSig"),
2023-02-19 11:54:39 -05:00
("got", prettyStr True t)]
2023-02-11 12:15:50 -05:00
toInfo (ExpectedEq t) =
[("type", "ExpectedEq"),
2023-02-19 11:54:39 -05:00
("got", prettyStr True t)]
2023-02-11 12:15:50 -05:00
toInfo (BadUniverse k l) =
[("type", "BadUniverse"),
("low", show k),
("high", show l)]
toInfo (ClashT mode ty s t) =
2023-02-19 11:54:39 -05:00
[("type", "ClashT"),
2023-02-11 12:15:50 -05:00
("mode", show mode),
("ty", prettyStr True ty),
("left", prettyStr True s),
("right", prettyStr True t)]
toInfo (ClashE mode e f) =
2023-02-19 11:54:39 -05:00
[("type", "ClashE"),
2023-02-11 12:15:50 -05:00
("mode", show mode),
("left", prettyStr True e),
("right", prettyStr True f)]
toInfo (ClashU mode k l) =
2023-02-19 11:54:39 -05:00
[("type", "ClashU"),
2023-02-11 12:15:50 -05:00
("mode", show mode),
("left", prettyStr True k),
("right", prettyStr True l)]
toInfo (ClashQ pi rh) =
2023-02-19 11:54:39 -05:00
[("type", "ClashQ"),
2023-02-11 12:15:50 -05:00
("left", prettyStr True pi),
("right", prettyStr True rh)]
toInfo (ClashD p q) =
2023-02-19 11:54:39 -05:00
[("type", "ClashD"),
2023-02-11 12:15:50 -05:00
("left", prettyStr True p),
("right", prettyStr True q)]
toInfo (NotType ty) =
[("type", "NotType"),
("got", prettyStr True ty)]
2023-02-11 12:15:50 -05:00
toInfo (WrongType ty s t) =
2023-02-19 11:54:39 -05:00
[("type", "WrongType"),
2023-02-11 12:15:50 -05:00
("ty", prettyStr True ty),
("left", prettyStr True s),
("right", prettyStr True t)]
2023-02-19 11:54:39 -05:00
-- [todo] add nested yamls to TAP and include context here
toInfo (WhileChecking _ _ _ _ err) = toInfo err
toInfo (WhileInferring _ _ _ err) = toInfo err
toInfo (WhileComparingT _ _ _ _ _ err) = toInfo err
toInfo (WhileComparingE _ _ _ _ err) = toInfo err