Commit 4b5190ad authored by simonpj's avatar simonpj
Browse files

[project @ 2003-04-09 08:06:59 by simonpj]

Add tcrun028
parent 4856d397
......@@ -30,4 +30,5 @@ test('tcrun024', normal, compile_and_run, ['-O'])
test('tcrun025', normal, multimod_compile_and_run, ['tcrun025',''])
test('tcrun026', normal, compile_and_run, [''])
test('tcrun027', normal, compile_and_run, [''])
test('tcrun028', normal, compile_and_run, [''])
test('church', normal, compile_and_run, [''])
{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances -dcore-lint #-}
-- This is a rather exotic functional-dependency test.
-- It crashed GHC 5.04.3 with a core-lint error, because
-- of a bug in tcSimplifyRestricted (fixed Apr 03)
module Main where
class ComposePS a b c | a b -> c where
(.>) :: PSOp a -> PSOp b -> PSOp c
(V a) .> (V b) = V (a ++ b)
instance (ConcatPS a b c, CheckPS c Id Id d) => ComposePS a b d
------------------------------------------------------------------------------
data PSOp a = V [String] deriving Show
data Id
data Push t rest
data Pop t rest
class Reverse a b c | a b -> c
instance Reverse Id b b
instance Reverse a (Pop t b) c => Reverse (Pop t a) b c
instance Reverse a (Push t b) c => Reverse (Push t a) b c
------------------------------------------------------------------------------
class ConcatPS a b c | a b -> c where
ccat :: a -> b -> c
instance ConcatPS Id a a
instance ConcatPS a b c => ConcatPS (Pop t a) b (Pop t c)
instance ConcatPS a b c => ConcatPS (Push t a) b (Push t c)
------------------------------------------------------------------------------
class CheckPS a b c d | a b c -> d where
check :: a -> b -> c -> d
check _ _ _ = error "oki"
instance Reverse a b c => CheckPS Id a b c
instance CheckPS a b (Push t c) d => CheckPS (Push t a) b c d
instance CheckPS a (Pop t b) Id d => CheckPS (Pop t a) b Id d
instance CheckPS a b c d => CheckPS (Pop t a) b (Push t c) d
v1 :: PSOp (Pop a Id)
v1 = V []
v2 :: PSOp Id
v2 = V []
t = v1 .> v2
main = print t
Supports Markdown
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