2023-02-11 12:15:50 -05:00
|
|
|
module TypingImpls
|
|
|
|
|
|
|
|
import TAP
|
|
|
|
import public Quox.Typing
|
|
|
|
import public Quox.Pretty
|
|
|
|
|
2023-02-22 01:45:10 -05:00
|
|
|
|
|
|
|
export
|
|
|
|
ToInfo WhnfErr where
|
|
|
|
toInfo (MissingEnumArm t ts) =
|
|
|
|
[("type", "MissingEnumArm"),
|
|
|
|
("tag", show t),
|
|
|
|
("list", show ts)]
|
|
|
|
|
2023-02-11 12:15:50 -05:00
|
|
|
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-22 01:45:10 -05:00
|
|
|
toInfo (ExpectedEnum t) =
|
|
|
|
[("type", "ExpectedEnum"),
|
|
|
|
("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)]
|
2023-02-22 01:45:10 -05:00
|
|
|
toInfo (TagNotIn t ts) =
|
|
|
|
[("type", "TagNotIn"),
|
|
|
|
("tag", show t),
|
|
|
|
("set", show $ SortedSet.toList ts)]
|
|
|
|
toInfo (BadCaseQtys qouts) =
|
|
|
|
("type", "BadCaseQtys") ::
|
|
|
|
[(show i, prettyStr True q) | (i, q) <- zip [0 .. length qouts] qouts]
|
|
|
|
|
2023-02-11 12:15:50 -05:00
|
|
|
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) =
|
2023-02-19 12:22:53 -05:00
|
|
|
[("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
|
2023-02-22 01:45:10 -05:00
|
|
|
|
|
|
|
toInfo (WhnfError err) = toInfo err
|