
Hello list, I don't know how to solve this problem. Using GHC 5.04.3. The following snippet shows the problem, as minimally as I could. tl2 = ["123","abc","def"] tl3 = newSTRef tl2 -- this works: tl3unref = runST(tl3 >>= \ref -> readSTRef ref) -- this code, the same but with a formal parameter, doesn't compile: -- this is line 61 in the error message below getaline rlines = runST(rlines >>= \ref -> readSTRef ref) --ghci complains as follows: Inferred type is less polymorphic than expected Quantified type variable `s' escapes It is mentioned in the environment: rlines :: ST s (STRef s a) (bound at misstring.hs:61) In the first argument of `runST', namely `(rlines >>= (\ ref -> readSTRef ref))' In the definition of `getaline': runST (rlines >>= (\ ref -> readSTRef ref)) -- I tried the following signature for getaline: getaline :: forall s. ST s (STRef s [[Char]]) -> [[Char]] -- which does not change the error. The type in the signature for -- rlines is that displayed by ghci for tl3 Any help will be greatly appreciated. TIA -- Seth Kurtzberg MIS Corp 480-661-1849 seth@cql.com

On Tue, Apr 29, 2003 at 07:17:41PM -0700, Seth Kurtzberg wrote:
Hello list,
getaline :: forall s. ST s (STRef s [[Char]]) -> [[Char]]
Try getaline :: (forall s. ST s (STRef s [[Char]])) -> [[Char]] This way you will use local universal quantification. The signature you gave is simply equivalent to getaline :: ST s (STRef s [[Char]]) -> [[Char]]
-- which does not change the error. The type in the signature for -- rlines is that displayed by ghci for tl3
Best regards, Tom -- .signature: Too many levels of symbolic links
participants (2)
-
Seth Kurtzberg
-
Tomasz Zielonka