[Haskell-cafe] Custom monad using ST

Yves Parès limestrael at gmail.com
Thu Mar 10 00:21:18 CET 2011


Well, I want to hide the fact that I'm using ST, so if I can hide the
existential type 's' it is better.

BTW, does someone know why the ST default implementation (the one exposed by
Control.Monad.ST) is strict, whereas those of State et Writer are lazy?


2011/3/9 Henning Thielemann <lemming at henning-thielemann.de>

>
> On Wed, 9 Mar 2011, Yves Parès wrote:
>
>  Hello,
>>
>> I am trying to make a monad that uses ST internally.
>> But even when reducing this to the simplest case I'm still cramped by the
>> 's' phantom
>> type :
>>
>> {-# LANGUAGE Rank2Types #-}
>>
>> newtype MyST a = MyST (forall s. ST s a)
>> -- ^ I cannot use " deriving (Monad) " through GeneralizedNewtypeDeriving
>>
>
> Would it make sense to make the 's' type explicit?
>
> newtype MyST s a = MyST (ST s a)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110310/9bb23bdc/attachment.htm>


More information about the Haskell-Cafe mailing list