diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/T21909.hs')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T21909.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T21909.hs b/testsuite/tests/typecheck/should_compile/T21909.hs new file mode 100644 index 0000000000..2485134703 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T21909.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableSuperClasses #-} + +module T21909 where + +import Data.Kind + +class (Monad m, MyMonad (Inner m)) => MyMonad m where + type Inner m :: Type -> Type + foo :: m Int + +works :: MyMonad m => m String +works = show <$> ((+ 1) <$> foo) + +fails :: MyMonad m => m String +fails = show <$> fooPlusOne + where + fooPlusOne = (+ 1) <$> foo + +alsoFails :: MyMonad m => m String +alsoFails = + let fooPlusOne = (+ 1) <$> foo + in show <$> fooPlusOne |