add enums, which also need whnf to be fallible :(

This commit is contained in:
rhiannon morris 2023-02-22 07:45:10 +01:00
parent 0e481a8098
commit efca9a7138
11 changed files with 269 additions and 64 deletions

View file

@ -4,6 +4,14 @@ import TAP
import public Quox.Typing
import public Quox.Pretty
export
ToInfo WhnfErr where
toInfo (MissingEnumArm t ts) =
[("type", "MissingEnumArm"),
("tag", show t),
("list", show ts)]
export
PrettyHL q => ToInfo (Error q) where
toInfo (NotInScope x) =
@ -18,6 +26,9 @@ PrettyHL q => ToInfo (Error q) where
toInfo (ExpectedSig t) =
[("type", "ExpectedSig"),
("got", prettyStr True t)]
toInfo (ExpectedEnum t) =
[("type", "ExpectedEnum"),
("got", prettyStr True t)]
toInfo (ExpectedEq t) =
[("type", "ExpectedEq"),
("got", prettyStr True t)]
@ -25,6 +36,14 @@ PrettyHL q => ToInfo (Error q) where
[("type", "BadUniverse"),
("low", show k),
("high", show l)]
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]
toInfo (ClashT mode ty s t) =
[("type", "ClashT"),
("mode", show mode),
@ -63,3 +82,5 @@ PrettyHL q => ToInfo (Error q) where
toInfo (WhileInferring _ _ _ err) = toInfo err
toInfo (WhileComparingT _ _ _ _ _ err) = toInfo err
toInfo (WhileComparingE _ _ _ _ err) = toInfo err
toInfo (WhnfError err) = toInfo err