diff options
Diffstat (limited to 'testsuite/tests/simplCore')
-rw-r--r-- | testsuite/tests/simplCore/should_run/T20836.hs | 23 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_run/all.T | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_run/T20836.hs b/testsuite/tests/simplCore/should_run/T20836.hs new file mode 100644 index 0000000000..462fdb3ac7 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T20836.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableSuperClasses #-} + +import Data.Kind (Type) + +class (Monad m, MonadFoo (FooM m)) => MonadFoo m where + type FooM m :: Type -> Type + runFoo :: FooM m a -> m a + +newtype MyMonad m a = MyMonad { runMyMonad :: m a } + deriving (Functor, Applicative, Monad) + +instance Monad m => MonadFoo (MyMonad m) where + type FooM (MyMonad m) = MyMonad m + runFoo = id + +main :: IO () +main = runMyMonad foo + +foo :: MonadFoo m => m () +foo = runFoo $ return () diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 509ae1ff57..bebd839724 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -105,3 +105,4 @@ test('T19313', normal, compile_and_run, ['']) test('UnliftedArgRule', normal, compile_and_run, ['']) test('T21229', normal, compile_and_run, ['-O']) test('T21575', normal, compile_and_run, ['-O']) +test('T20836', normal, compile_and_run, ['-O0']) # Should not time out; See #20836 |