blob: 418a695e8d9f1f28643522f56f29a196b92b047a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
{-# LANGUAGE RebindableSyntax #-}
-- Trac #303
module T where
import qualified Prelude as P
class IxMonad m where
return :: a -> m i i a
(>>=) :: m i j a -> (a -> m j k b) -> m i k b
(>>) :: m i j a -> m j k b -> m i k b
m >> n = m >>= \_ -> n
fail :: P.String -> m i j a
fail s = P.error s
data T a b c = T
instance IxMonad T where
return _ = T
m >>= f = T
fail _ = T
testM :: T (a,b) b a
testM = T
test1 = testM >>= \x -> return x
test2 = do
x <- testM
return x
|