On Jan 1, 2007, at 6:02 , Yitzchak Gale wrote:

Prelude Control.Monad.ST> (runST . return) 42

<interactive>:1:9:
   Couldn't match expected type `forall s. ST s a'
          against inferred type `m a1'

I think the problem is that technically runST is a data constructor (possibly not relevant) which takes a function as a parameter (definitely relevant). In the normal compositional model, (f . g) x = f (g x), you're conceptually invoking f on the result of g x (g is independent of f); here, you're lifting the function g x into the ST s a monad via f (g is dependent on f).

--
brandon s. allbery    [linux,solaris,freebsd,perl]     [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to