[Haskell-cafe] GHC 7.4: Expected behavior or bug?

Michael Snoyman michael at snoyman.com
Tue Dec 27 20:11:47 CET 2011


Thanks for the explanation.

2011/12/27 José Pedro Magalhães <jpm at cs.uu.nl>:
> Hi,
>
> This is a change in behavior. Previously GHC was more liberal than Haskell
> 98 prescribed, and would not default the kind of otherwise unconstrained
> type variables to *. 7.4 does default to *, so you have to provide kind
> signatures when you want another kind (particularly in phantom type
> variables).
>
>
> Cheers,
> Pedro
>
>
> On Tue, Dec 27, 2011 at 16:47, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
>>
>> On 27 December 2011 17:38, Michael Snoyman <michael at snoyman.com> wrote:
>> > Thanks to Mark Wright for pointing this out[1].
>> >
>> > We have the equivalent of the following code in persistent:
>> >
>> > {-# LANGUAGE MultiParamTypeClasses #-}
>> > data Key backend entity = Key
>> >
>> > class Monad (b m) => Foo b m where
>> >    func :: b m (Key b m)
>> >
>> > This code works fine with GHC 7.0, but I get the following message from
>> > GHC 7.4:
>> >
>> >    Expecting two more arguments to `b'
>> >    In the type `b m (Key b m)'
>> >    In the class declaration for `Foo'
>> >
>> > Is this expected behavior, or a bug? If the former, what would be a
>> > possible workaround?
>> >
>> > Thanks,
>> > Michael
>> >
>> > [1] https://github.com/yesodweb/persistent/issues/31
>> >
>> > _______________________________________________
>> > Haskell-Cafe mailing list
>> > Haskell-Cafe at haskell.org
>> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>> I fixed a similar breakage in the hmatrix library:
>>
>>
>> https://github.com/AlbertoRuiz/hmatrix/commit/a4f38eb196209436f72b938f6355f6e28474bef3
>>
>> I don't know if it's a bug in GHC, but the workaround is to add an
>> explicit kind signature:
>>
>> {-# LANGUAGE KindSignatures, MultiParamTypeClasses #-}
>> data Key (backend :: * -> * -> *) entity = Key
>>
>> class Monad (b m) => Foo b m where
>>   func :: b m (Key b m)
>>
>> Cheers,
>>
>> Bas
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>



More information about the Haskell-Cafe mailing list