[GHC] #14419: Check kinds for ambiguity
GHC
ghc-devs at haskell.org
Wed Nov 7 17:23:16 UTC 2018
#14419: Check kinds for ambiguity
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by goldfire:
Old description:
> GHC does an ambiguity check on types. It should also do the same for
> kinds. Here is a program that should be rejected:
>
> {{{#!hs
> type family F a
> data T :: F a -> Type
> }}}
>
> `T`'s kind is ambiguous, and any occurrence of `T` will be rejected.
> Instead of rejecting usage sites, let's just reject the definition site.
>
> This check would be disabled by `AllowAmbiguousTypes`.
>
> Happily, I think the implementation should be easy, and that the current
> algorithm to check for ambiguous types should work for kinds, too. After
> all, types and kinds are the same these days.
>
> This was inspired by #14203, but no need to read that ticket to
> understand this one.
New description:
GHC does an ambiguity check on types. It should also do the same for
kinds. Here is a program that should be rejected:
{{{#!hs
type family F a
data T :: F a -> Type
}}}
`T`'s kind is ambiguous, and any occurrence of `T` will be rejected.
Instead of rejecting usage sites, let's just reject the definition site.
This check would be disabled by `AllowAmbiguousTypes`.
Happily, I think the implementation should be easy, and that the current
algorithm to check for ambiguous types should work for kinds, too. After
all, types and kinds are the same these days.
This was inspired by #14203, but no need to read that ticket to understand
this one.
EDIT: See comment:8 and comment:10 for the nub of what needs to be done
here.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14419#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list