diff --git a/tests/Coerce.hs b/tests/Coerce.hs index 031f3186..c1ca8b09 100644 --- a/tests/Coerce.hs +++ b/tests/Coerce.hs @@ -13,10 +13,14 @@ toInt = coerce toInts :: (Coercible a Int) => [a] -> [Int] toInts = coerce +casbs :: (Coercible a b) => [a] -> [b] +casbs = coerce + main :: IO () main = do print (toInt (NT 5)) print (toInts [NT 1, NT 2] :: [Int]) + print (casbs [NT 1, NT 2, NT 3] :: [Int]) print (coerce (List [3::Int, 4]) :: [Int]) print (coerce (List [NT 5, NT 6]) :: [NT]) print (coerce (List [NT 7, NT 8]) :: [Int]) diff --git a/tests/Coerce.ref b/tests/Coerce.ref new file mode 100644 index 00000000..257827f3 --- /dev/null +++ b/tests/Coerce.ref @@ -0,0 +1,6 @@ +5 +[1,2] +[1,2,3] +[3,4] +[NT 5,NT 6] +[7,8] diff --git a/tests/Makefile b/tests/Makefile index b3e2b14a..e6e84ffe 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -79,6 +79,7 @@ test: $(TMHS) OrPat && $(EVAL) > OrPat.out && diff OrPat.ref OrPat.out $(TMHS) PartRed && $(EVAL) > PartRed.out && diff PartRed.ref PartRed.out $(TMHS) PatSyn && $(EVAL) > PatSyn.out && diff PatSyn.ref PatSyn.out + $(TMHS) Coerce && $(EVAL) > Coerce.out && diff Coerce.ref Coerce.out errtest: sh errtester.sh $(MHS) < errmsg.test