summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2018-06-01 16:36:57 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2018-06-04 10:35:34 +0100
commit9d600ea68c283b0d38ac663c3cc48baba6b94f57 (patch)
tree5b03fafa7ebadc432833376dcd293f56b56e5989 /testsuite
parent0e5d2b7442ff9e55837913a53da451fb97417496 (diff)
downloadhaskell-9d600ea68c283b0d38ac663c3cc48baba6b94f57.tar.gz
Expand type synonyms when Linting a forall
Trac #14939 showed a type like type Alg cls ob = ob f :: forall (cls :: * -> Constraint) (b :: Alg cls *). b where the kind of the forall looks like (Alg cls *), with a free cls. This tripped up Core Lint. I fixed this by making Core Lint a bit more forgiving, expanding type synonyms if necessary. I'm worried that this might not be the whole story; notably typeKind looks suspect. But it certainly fixes this problem.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/polykinds/T14939.hs19
-rw-r--r--testsuite/tests/polykinds/all.T1
2 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T14939.hs b/testsuite/tests/polykinds/T14939.hs
new file mode 100644
index 0000000000..eb3c700f9f
--- /dev/null
+++ b/testsuite/tests/polykinds/T14939.hs
@@ -0,0 +1,19 @@
+{-# Language RankNTypes, ConstraintKinds, TypeInType, GADTs #-}
+
+module T14939 where
+
+import Data.Kind
+
+type Cat ob = ob -> ob -> Type
+
+type Alg cls ob = ob
+
+newtype Frí (cls::Type -> Constraint) :: (Type -> Alg cls Type) where
+ Frí :: { with :: forall x. cls x => (a -> x) -> x }
+ -> Frí cls a
+
+data AlgCat (cls::Type -> Constraint) :: Cat (Alg cls Type) where
+ AlgCat :: (cls a, cls b) => (a -> b) -> AlgCat cls a b
+
+leftAdj :: AlgCat cls (Frí cls a) b -> (a -> b)
+leftAdj (AlgCat f) a = undefined \ No newline at end of file
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 788832d6d3..4fe88b2385 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -192,3 +192,4 @@ test('SigTvKinds3', normal, compile_fail, [''])
test('T15116', normal, compile_fail, [''])
test('T15116a', normal, compile_fail, [''])
test('T15170', normal, compile, [''])
+test('T14939', normal, compile, ['-O'])