[Haskell-cafe] ContT and ST stack
Bas van Dijk
v.dijk.bas at gmail.com
Fri Mar 11 12:04:54 CET 2011
On 11 March 2011 11:15, Max Bolingbroke <batterseapower at hotmail.com> wrote:
> On 10 March 2011 17:55, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
>> On 10 March 2011 18:24, Yves Parès <limestrael at gmail.com> wrote:
>>> Why has the operator (.) troubles with a type like (forall s. ST s a)?
>>>
>>> Why can't it match the type 'b' in (.) definition?
>>
>> As explained by the email from SPJ that I linked to, instantiating a
>> type variable (like 'b') with a polymorphic type (like 'forall s. ST s
>> a' ) is called impredicative polymorphism. Since GHC-7 this is not
>> supported any more because it was to complicated.
>
> AFAIK this decision was reversed because SPJ found a simple way to
> support them. Indeed, they work fine in 7.0.2 and generate warnings.
> Try it out:
Great!
Unfortunately foo still doesn't type check in 7.0.2:
foo :: (forall s. ST s a) -> a
foo st = ($) runST st
For the same reason I still need this ugly hack in usb-safe:
http://hackage.haskell.org/packages/archive/usb-safe/0.12/doc/html/src/System-USB-Safe.html#withDeviceWhich
Bas
More information about the Haskell-Cafe
mailing list