Impredicative types and forall regression in 8.0 ?

Vincent Hanquez tab at snarc.org
Tue Feb 16 07:43:25 UTC 2016



On 15/02/2016 10:49, Adam Gundry wrote:
> Hi Vincent,
>
> On 15/02/16 09:44, Vincent Hanquez wrote:
>> I recently came across a compilation problem on 8.0 that do not trigger
>> on < 8.0. I've reduced the issue to this snippet with Rank2Types:
>>
>>      type Action = (forall a . Show a => a) -> Int
>>      data Command = Command (Maybe Action)
>>
>>      com1 = Command Nothing
>>
>> With GHC 7.0 to 7.10, this compile and works.
> This shouldn't be accepted without ImpredicativeTypes[*], but GHC
> versions prior to 8.0 failed to look through the type synonym. Note that
> if you say
>
>      data Command = Command (Maybe ((forall a . Show a => a) -> Int))
>
> then earlier versions report an error. Take a look at GHC ticket #10194
> for more details: https://ghc.haskell.org/trac/ghc/ticket/10194
Ok, make sense; After reading what ImpredicativeTypes are, I can see the 
difference in the construct.

Thanks,
-- 
Vincent


More information about the ghc-devs mailing list