Commit 34b9c75b authored by mnislaih's avatar mnislaih
Browse files

Add a new test for #1537

parent cc1a5617
......@@ -16,3 +16,4 @@ test('rebindable6', normal, compile_and_run, [''])
test('rebindable7', normal, compile_and_run, [''])
test('rebindable8', if_compiler_lt('ghc', '6.9', expect_broken(1537)),
compile, [''])
test('rebindable9', expect_broken(1537), compile, [''])
{-# OPTIONS -fno-implicit-prelude -fglasgow-exts #-}
-- Trac #1537
module Foo where
import qualified Prelude
import Prelude hiding (Monad(..))
import Control.Monad.Identity (Identity(..))
class Bind m1 m2 m3 | m1 m2 -> m3 where
(>>=) :: m1 a -> (a -> m2 b) -> m3 b
class Return m where
returnM :: a -> m a
fail :: String -> m a
instance Bind Maybe [] [] where
Just x >>= f = f x
Nothing >>= f = []
instance Functor a => Bind Identity a a where m >>= f = f (runIdentity m)
instance Functor a => Bind a Identity a where m >>= f = fmap (runIdentity . f) m
instance Prelude.Monad m => Bind m m m where (>>=) = (Prelude.>>=)
instance Return [] where
returnM x = [x]
fail _ = []
return :: a -> Identity a
return = Prelude.return
should_compile :: [Int]
should_compile = do
a <- Just 1
b <- [a*1,a*2]
return (b+1)
\ No newline at end of file
Markdown is supported
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