[Haskell-beginners] Type inference in ST monad?

Brandon Allbery allbery.b at gmail.com
Mon Aug 19 15:59:28 CEST 2013


On Mon, Aug 19, 2013 at 1:36 AM, Aurimas <aurimas.anskaitis at vgtu.lt> wrote:

> Thanks, this is clearly the most easy way to fix the problem. But the
> question remains - why the line
> "do r1 <- uniformR (-1.0, 1.0 :: Double) gen"    cannot be annotated with
> ST s Double?
>

Maybe you need ScopedTypeVariables? But I'd be suspicious that, given the
forall in the definition of ST, that such a type annotation *always*
creates a new `s` and some other way to "force" the type is needed.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130819/dbf6a21d/attachment.htm>


More information about the Beginners mailing list