1- {-# LANGUAGE OverloadedStrings #-}
1+ {-# LANGUAGE OverloadedStrings, TypeOperators #-}
22module Main (main ) where
33
44import Data.String
@@ -9,6 +9,7 @@ import Test.Tasty
99import Test.Tasty.Hedgehog
1010import Test.Tasty.HUnit
1111
12+ import Control.Effect.Sum
1213import Data.File
1314import qualified Generators as Gen
1415import qualified Analysis.Eval as Eval
@@ -20,7 +21,7 @@ import Data.Term
2021
2122-- * Helpers
2223
23- true , false :: Term Core User
24+ true , false :: Term ( Ann :+: Core ) User
2425true = bool True
2526false = bool False
2627
@@ -30,10 +31,10 @@ parseEither p = Trifecta.foldResult (Left . show . Trifecta._errDoc) Right . Tri
3031-- * Parser roundtripping properties. Note that parsing and prettyprinting is generally
3132-- not a roundtrip, because the parser inserts 'Ann' nodes itself.
3233
33- prop_roundtrips :: Gen (Term Core User ) -> Property
34+ prop_roundtrips :: Gen (Term ( Ann :+: Core ) User ) -> Property
3435prop_roundtrips gen = property $ do
3536 input <- forAll gen
36- tripping input showCore (parseEither (Parse. core <* Trifecta. eof))
37+ tripping input ( showCore . stripAnnotations) (parseEither (Parse. core <* Trifecta. eof))
3738
3839parserProps :: TestTree
3940parserProps = testGroup " Parsing: roundtripping"
@@ -46,7 +47,7 @@ parserProps = testGroup "Parsing: roundtripping"
4647
4748-- * Parser specs
4849
49- parsesInto :: String -> Term Core User -> Assertion
50+ parsesInto :: String -> Term ( Ann :+: Core ) User -> Assertion
5051parsesInto str res = case parseEither Parse. core str of
5152 Right x -> x @?= res
5253 Left m -> assertFailure m
@@ -56,7 +57,7 @@ assert_booleans_parse = do
5657 parseEither Parse. core " #true" @?= Right true
5758 parseEither Parse. core " #false" @?= Right false
5859
59- a , f , g , h :: Term Core User
60+ a , f , g , h :: Term ( Ann :+: Core ) User
6061(a, f, g, h) = (pure " a" , pure " f" , pure " g" , pure " h" )
6162
6263assert_ifthen_parse :: Assertion
@@ -92,9 +93,9 @@ parserSpecs = testGroup "Parsing: simple specs"
9293 , testCase " quoted names" assert_quoted_name_parse
9394 ]
9495
95- assert_roundtrips :: File (Term Core User ) -> Assertion
96- assert_roundtrips (File _ core) = case parseEither Parse. core (showCore core) of
97- Right v -> v @?= stripAnnotations core
96+ assert_roundtrips :: File (Term ( Ann :+: Core ) User ) -> Assertion
97+ assert_roundtrips (File _ core) = case parseEither Parse. core (showCore (stripAnnotations core) ) of
98+ Right v -> stripAnnotations v @?= stripAnnotations core
9899 Left e -> assertFailure e
99100
100101parserExamples :: TestTree
0 commit comments