diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2016-02-22 21:32:51 +0100 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2016-02-23 12:27:47 +0100 |
commit | 754a2f2bb7416bd7fe453ba7bcb7c089f5ef3b8f (patch) | |
tree | 45bc14d7e354e9b985a33ba3c7242fd490e1e025 /testsuite/tests/rebindable | |
parent | 8626ac91a3cac028bbe742f07a1ce9fb598589f6 (diff) | |
download | haskell-754a2f2bb7416bd7fe453ba7bcb7c089f5ef3b8f.tar.gz |
Testsuite: delete Windows line endings [skip ci] (#11631)
Diffstat (limited to 'testsuite/tests/rebindable')
-rw-r--r-- | testsuite/tests/rebindable/T303.hs | 60 | ||||
-rw-r--r-- | testsuite/tests/rebindable/rebindable7.hs | 76 |
2 files changed, 68 insertions, 68 deletions
diff --git a/testsuite/tests/rebindable/T303.hs b/testsuite/tests/rebindable/T303.hs index 418a695e8d..c9be12469c 100644 --- a/testsuite/tests/rebindable/T303.hs +++ b/testsuite/tests/rebindable/T303.hs @@ -1,30 +1,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
+{-# 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 diff --git a/testsuite/tests/rebindable/rebindable7.hs b/testsuite/tests/rebindable/rebindable7.hs index 8e0000e0e5..01f3eda6dc 100644 --- a/testsuite/tests/rebindable/rebindable7.hs +++ b/testsuite/tests/rebindable/rebindable7.hs @@ -1,38 +1,38 @@ -{-# OPTIONS -XRebindableSyntax #-}
-
--- This one tests rebindable syntax for do-notation
-
-module Main where
-
-import qualified Prelude
-import GHC.Num
-import GHC.Base hiding( Monad(..) )
-
-class Foo a where
- op :: a -> a
-
-data T a = MkT a
-
-instance Foo Int where
- op x = x+1
-
-(>>=) :: Foo a => T a -> (a -> T b) -> T b
-(>>=) (MkT x) f = f (op x)
-
-(>>) :: Foo a => T a -> T b -> T b
-(>>) x y = x >>= (\_ -> y)
-
-return :: Num a => a -> T a
-return x = MkT (x+1)
-
-fail :: String -> T a
-fail s = error "urk"
-
-t1 :: T Int
-t1 = MkT 4
-
-myt = do { x <- t1
- ; return x }
-
-main = case myt of
- MkT i -> Prelude.print i
+{-# OPTIONS -XRebindableSyntax #-} + +-- This one tests rebindable syntax for do-notation + +module Main where + +import qualified Prelude +import GHC.Num +import GHC.Base hiding( Monad(..) ) + +class Foo a where + op :: a -> a + +data T a = MkT a + +instance Foo Int where + op x = x+1 + +(>>=) :: Foo a => T a -> (a -> T b) -> T b +(>>=) (MkT x) f = f (op x) + +(>>) :: Foo a => T a -> T b -> T b +(>>) x y = x >>= (\_ -> y) + +return :: Num a => a -> T a +return x = MkT (x+1) + +fail :: String -> T a +fail s = error "urk" + +t1 :: T Int +t1 = MkT 4 + +myt = do { x <- t1 + ; return x } + +main = case myt of + MkT i -> Prelude.print i |