| > Now, the error message you get is deeply obscure, I grant you. Trouble | > is, this variant IS ok: | > | > foo = id wibble | > | > wibble :: ((forall s. ST s b) -> b) -> b | > | > Why? For the same reason that this is OK | > | > foo = id reverse | > | > That, is we can instantiate the type of the argument to a monotype (a | > type without for-alls). | | Sorry, I don't understand yet. Why isn't the "forall s" in wibble's type a | problem? I'll explain by showing the translation. Here it is for the reverse example. Notice that we instantiate reverse before passing it to 'id'. I'm using curly braces for type application. foo = /\a. id {a} (reverse {a}) Now here's the more complicated version for 'wibble' foo = /\s b. id {(ST s b -> Int) -> Int} (\x::(ST s b - >Int). wibble {b} (/\f::(forall s1. ST s1 b). (x (f {s})))) Simon
participants (1)
-
Simon Peyton-Jones