Question aboutthe use of an inner forall

Ashley Yakeley ashley@semantic.org
Mon, 19 Aug 2002 03:30:45 -0700


At 2002-08-18 20:19, Jay Cox wrote:

>#ST> runST (newSTRef (3::Prelude.Int))
>#
>#Ambiguous type variable(s) `a' in the constraint `PrelShow.Show a'
>#arising from use of `PrelIO.print' at <No locn>
>#In a 'do' expression pattern binding: PrelIO.print it

I don't understand this either, actually:

  $ ghci -fglasgow-exts -package lang 
     ___         ___ _
    / _ \ /\  /\/ __(_)
   / /_\// /_/ / /  | |      GHC Interactive, version 5.04, for Haskell 
98.
  / /_\\/ __  / /___| |      http://www.haskell.org/ghc/
  \____/\/ /_/\____/|_|      Type :? for help.
  
  Loading package base ... linking ... done.
  Loading package haskell98 ... linking ... done.
  Loading package lang ... linking ... done.
  Prelude> :module ST
  Prelude ST> :type runST
  
  Inferred type is less polymorphic than expected
      Quantified type variable `s' escapes
      Expected type: ST s a -> t
      Inferred type: (forall s1. ST s1 a) -> a
  Prelude ST> 

What's up with that? Can't I even look at the type? Is this the 
monomorphism restriction or something?

-- 
Ashley Yakeley, Seattle WA