summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T22707.hs
blob: 35b0817ec28a096933990fe6eab019c6bf4763eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module T22707 where

newtype Cont o i a = Cont {runCont ::(a -> i) -> o }

t1:: Cont (i2 -> o) i1 a -> Cont o i2 (a -> i1)
t1 c = Cont $ \ati1tti2 -> (runCont c) (ati1tti2 $ \a -> evalCont (t1 c) >>== \ati1 -> return ati1 a )

evalCont:: Cont o a a -> o
evalCont c = (runCont c)id

instance Monad (Cont p p) where
  return a = Cont ($ a)
  (>>=) = (>>==)

class PMonad m where
  (>>==):: m p q a -> (a -> m q r b) -> m p r b

instance PMonad Cont where
 (Cont cont) >>== afmb = Cont $ \bti -> cont $ \a -> (runCont . afmb) a bti

main:: IO ()
main = putStrLn "bug"