i tried your solution on the function "f" used in earlier mesgs and got
the same problem:
paratha% ghc lazy.hs
lazy.hs:6: Couldn't match the type `ST' against `ST'
Expected: `ST taMI taML'
Inferred: `ST taN9 taMu'
In the first argument of `runST', namely
`(do
n <- newSTRef x
readSTRef n)'
In an equation for function `f':
`f x
= runST (do
n <- newSTRef x
readSTRef n)'
lazy.hs:1: Ambiguous context `{Show taMW}'
`Show taMW' arising from use of `print' at lazy.hs:3
Compilation had errors
paratha% cat lazy.hs
import LazyST
import ST(runST)
main = print $ f True
f x = runST(
do n <- newSTRef x
readSTRef n
)
paratha% ghc lazy2.hs
Module version unchanged at 2
paratha% cat lazy2.hs
import LazyST
import ST(runST)
main = print $ f True
f x = runST( lazyToStrictST $
do n <- newSTRef x
readSTRef n
)
paratha%
byron
On 1 Dec 1997, Simon Marlow wrote:
> Byron Cook <[EMAIL PROTECTED]> writes:
>
> > that didn't quite work --- it gave a type error.
>
> Bizarre... it worked for me. Did you get the indentation right when
> you cut 'n' pasted it? :-)
>
> --
> Simon Marlow [EMAIL PROTECTED]
> University of Glasgow http://www.dcs.gla.ac.uk/~simonm/
> finger for PGP public key
>