diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2018-06-16 23:44:39 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-16 23:44:57 -0400 |
commit | 8df24474d0194d28b8273c1539af05793156e23f (patch) | |
tree | eeeaf190edb831e45fb23af1960213b530637794 /libraries/base | |
parent | 4cd552184cbc5bed33da21497537df4e400a1a2f (diff) | |
download | haskell-8df24474d0194d28b8273c1539af05793156e23f.tar.gz |
Warn about implicit kind variables with -Wcompat
According to an accepted proposal
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/002
4-no-kind-vars.rst
With -Wcompat, warn if a kind variable is brought into scope
implicitly in a type with an explicit forall. This applies to type
signatures and to other contexts that allow a forall with the
forall-or-nothing rule in effect (for example, class instances).
Test Plan: Validate
Reviewers: goldfire, hvr, bgamari, RyanGlScott
Reviewed By: goldfire
Subscribers: RyanGlScott, rwbarton, thomie, carter
GHC Trac Issues: #15264
Differential Revision: https://phabricator.haskell.org/D4834
Diffstat (limited to 'libraries/base')
-rw-r--r-- | libraries/base/Data/Typeable/Internal.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 09290485e4..0d4fc825cf 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -476,7 +476,7 @@ splitApp (TrTyCon{trTyCon = con, trKindVars = kinds}) Refl -> IsCon con kinds -- | Use a 'TypeRep' as 'Typeable' evidence. -withTypeable :: forall (a :: k) (r :: TYPE rep). () +withTypeable :: forall k (a :: k) rep (r :: TYPE rep). () => TypeRep a -> (Typeable a => r) -> r withTypeable rep k = unsafeCoerce k' rep where k' :: Gift a r @@ -631,7 +631,7 @@ unkindedTypeRep :: SomeKindedTypeRep k -> SomeTypeRep unkindedTypeRep (SomeKindedTypeRep x) = SomeTypeRep x data SomeKindedTypeRep k where - SomeKindedTypeRep :: forall (a :: k). TypeRep a + SomeKindedTypeRep :: forall k (a :: k). TypeRep a -> SomeKindedTypeRep k kApp :: SomeKindedTypeRep (k -> k') @@ -640,7 +640,7 @@ kApp :: SomeKindedTypeRep (k -> k') kApp (SomeKindedTypeRep f) (SomeKindedTypeRep a) = SomeKindedTypeRep (mkTrApp f a) -kindedTypeRep :: forall (a :: k). Typeable a => SomeKindedTypeRep k +kindedTypeRep :: forall k (a :: k). Typeable a => SomeKindedTypeRep k kindedTypeRep = SomeKindedTypeRep (typeRep @a) buildList :: forall k. Typeable k @@ -980,7 +980,8 @@ tcNat :: TyCon tcNat = typeRepTyCon (typeRep @Nat) -- | An internal function, to make representations for type literals. -typeLitTypeRep :: forall (a :: k). (Typeable k) => String -> TyCon -> TypeRep a +typeLitTypeRep :: forall k (a :: k). (Typeable k) => + String -> TyCon -> TypeRep a typeLitTypeRep nm kind_tycon = mkTrCon (mkTypeLitTyCon nm kind_tycon) [] -- | For compiler use. |