[project @ 1997-10-15 14:21:58 by simonm]
authorsimonm <unknown>
Wed, 15 Oct 1997 14:21:59 +0000 (14:21 +0000)
committersimonm <unknown>
Wed, 15 Oct 1997 14:21:59 +0000 (14:21 +0000)
new test for type-synonym-arity bug (fixed in TcMonoType.lhs v1.19)

ghc/tests/typecheck/should_compile/tc093.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc093.stderr [new file with mode: 0644]

diff --git a/ghc/tests/typecheck/should_compile/tc093.hs b/ghc/tests/typecheck/should_compile/tc093.hs
new file mode 100644 (file)
index 0000000..f9a5179
--- /dev/null
@@ -0,0 +1,25 @@
+module ShouldSucceed where
+
+data State c a = State (c -> (a,c))
+
+unState :: State c a -> (c -> (a,c))
+unState (State x) = x
+
+unitState :: a -> State c a
+unitState a = State (\s0 -> (a,s0))
+
+bindState :: State c a -> (a -> State c b) -> State c b
+bindState m k = State (\s0 -> let (a,s1) = (unState m) s0
+                                  (b,s2) = (unState (k a)) s1 
+                              in (b,s2))
+
+instance Eq c => Monad (State c) where
+    return = unitState 
+    (>>=)  = bindState 
+
+data TS = TS { vs::Int } deriving (Show,Eq)
+
+type St = State TS
+
+foo :: Int -> St Int  -- it works if this line is not given
+foo x = return x
diff --git a/ghc/tests/typecheck/should_compile/tc093.stderr b/ghc/tests/typecheck/should_compile/tc093.stderr
new file mode 100644 (file)
index 0000000..99091fe
--- /dev/null
@@ -0,0 +1,29 @@
+ghc: module version changed to 1; reason: no old .hi file
+_interface_ ShouldSucceed 1
+_instance_modules_
+ArrBase IO PrelNum
+_usages_
+PrelBase 1 :: $d1 1 $d12 1 $d15 1 $d16 1 $d2 1 $d22 1 $d25 1 $d27 1 $d28 1 $d3 1 $d33 1 $d34 1 $d35 1 $d38 1 $d39 1 $d4 1 $d40 1 $d42 1 $d43 1 $d45 1 $d46 1 $d47 1 $d50 1 $d51 1 $d52 1 $d55 1 $d56 1 $d7 1 $d8 1 $d9 1 $m- 1 $m/= 1 $m< 1 $m<= 1 $m> 1 $m>= 1 $m>> 1 $mcompare 1 $mfromInt 1 $mmax 1 $mmin 1 $mshowList 1 && 1 . 1 not 1 showList__ 1 showParen 1 showSpace 1 showString 1 Eq 1 Eval 1 Monad 1 Num 1 Ord 1 Ordering 1 Show 1 ShowS 1 String 1;
+PrelNum 1 :: $d10 1 $d16 1 $d17 1 $d18 1 $d29 1 $d33 1 $d34 1 $d35 1;
+PrelTup 1 :: $d13 1 $d4 1 $d49 1 $d9 1;
+_exports_
+ShouldSucceed bindState foo unState unitState St State(State) TS(TS vs);
+_instances_
+instance _forall_ [c] {PrelBase.Eq c} => {PrelBase.Monad (State c)} = $d1;
+instance {PrelBase.Eq TS} = $d2;
+instance {PrelBase.Eval TS} = $d3;
+instance _forall_ [c a] => {PrelBase.Eval (State c a)} = $d4;
+instance {PrelBase.Show TS} = $d5;
+_declarations_
+1 $d1 _:_ _forall_ [c] {PrelBase.Eq c} => {PrelBase.Monad (State c)} ;;
+1 $d2 _:_ {PrelBase.Eq TS} ;;
+1 $d3 _:_ {PrelBase.Eval TS} ;;
+1 $d4 _:_ _forall_ [c a] => {PrelBase.Eval (State c a)} ;;
+1 $d5 _:_ {PrelBase.Show TS} ;;
+1 type St = State TS ;
+1 data State c a = State (c -> (a, c)) ;
+1 data TS = TS {vs :: PrelBase.Int} ;
+1 bindState _:_ _forall_ [ta tb tc] => State tb ta -> (ta -> State tb tc) -> State tb tc ;;
+1 foo _:_ PrelBase.Int -> State TS PrelBase.Int ;;
+1 unState _:_ _forall_ [ta tb] => State tb ta -> tb -> (ta, tb) ;;
+1 unitState _:_ _forall_ [ta tb] => tb -> State ta tb ;;