Commit fc19d4af authored by Ian Lynagh's avatar Ian Lynagh

Add a test gadt23 from Christophe Poucet

parent 4b426f50
{-# OPTIONS_GHC -fglasgow-exts #-}
module Gadt23_AST where
data Exp_;
data AST :: * -> * -> * where
Var :: String -> AST Exp_ tag
Tag :: tag -> AST a tag -> AST a tag
......@@ -8,3 +8,10 @@ gadt17:
@$(RM) A$(OBJSUFFIX)
$(TEST_HC) -c Gadt17_help.hs
$(TEST_HC) -c gadt17.hs
gadt23:
$(RM) gadt23.hi gadt23.o Gadt23_AST.hi Gadt23_AST.o
$(TEST_HC) -v0 --make gadt23.hs
touch gadt23.hs
$(TEST_HC) -v0 --make gadt23.hs
......@@ -27,6 +27,8 @@ test('gadt19', normal, compile, [''])
test('gadt20', normal, compile, [''])
test('gadt21', normal, compile_fail, [''])
test('gadt22', normal, compile, [''])
test('gadt23', normal, run_command, ['$MAKE -s gadt23'])
clean(['Gadt23_AST.hi', 'Gadt23_AST.o'])
test('red-black', normal, compile, [''])
test('type-rep', skip_if_fast, compile_and_run, [''])
......
module Main where
import Gadt23_AST
data Foo = Foo { bar :: Int }
convert :: AST a tag -> AST a Foo
convert t = case t of
Var v -> Tag (Foo 42) $ Var v
Tag t e -> Tag (Foo 42) $ convert e
main = return ()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment