@@ -18,10 +18,11 @@ import Data.Core
1818import Data.Core.Pretty
1919import Data.Core.Parser as Parse
2020import Data.Name
21+ import Data.Term
2122
2223-- * Helpers
2324
24- true , false :: Core
25+ true , false :: Term Core Name
2526true = Bool True
2627false = Bool False
2728
@@ -33,7 +34,7 @@ parseEither p = Trifecta.foldResult (Left . show . Trifecta._errDoc) Right . Tri
3334-- * Parser roundtripping properties. Note that parsing and prettyprinting is generally
3435-- not a roundtrip, because the parser inserts 'Ann' nodes itself.
3536
36- prop_roundtrips :: Gen Core -> Property
37+ prop_roundtrips :: Gen ( Term Core Name ) -> Property
3738prop_roundtrips gen = property $ do
3839 input <- forAll gen
3940 tripping input showCore (parseEither (Parse. core <* Trifecta. eof))
@@ -48,7 +49,7 @@ parserProps = testGroup "Parsing: roundtripping"
4849
4950-- * Parser specs
5051
51- parsesInto :: String -> Core -> Assertion
52+ parsesInto :: String -> Term Core Name -> Assertion
5253parsesInto str res = case parseEither Parse. core str of
5354 Right x -> x @?= res
5455 Left m -> assertFailure m
@@ -58,7 +59,7 @@ assert_booleans_parse = do
5859 parseEither Parse. core " #true" @?= Right true
5960 parseEither Parse. core " #false" @?= Right false
6061
61- a , f , g , h :: Core
62+ a , f , g , h :: Term Core Name
6263(a, f, g, h) = (Var " a" , Var " f" , Var " g" , Var " h" )
6364
6465assert_ifthen_parse :: Assertion
@@ -102,7 +103,7 @@ parserSpecs = testGroup "Parsing: simple specs"
102103 , testCase " let in push" assert_let_in_push_precedence
103104 ]
104105
105- assert_roundtrips :: File Core -> Assertion
106+ assert_roundtrips :: File ( Term Core Name ) -> Assertion
106107assert_roundtrips (File _ core) = parseEither Parse. core (showCore core) @?= Right (stripAnnotations core)
107108
108109parserExamples :: TestTree
0 commit comments