Does "Value Restriction" mean that there is no higher order functional programming?

Posted by Sadache on Stack Overflow See other posts from Stack Overflow or by Sadache
Published on 2010-04-15T12:09:40Z Indexed on 2010/04/16 1:53 UTC
Read the original article Hit count: 244

Does "Value Restriction" mean that there is no higher order functional programming?

I have a problem that each time I try to do a bit of HOP I get caught by a VR error. Example:

let simple (s:string)= fun rq->1 
let oops= simple ""

type 'a SimpleType= F of (int ->'a-> 'a)
let get a = F(fun req -> id)  
let oops2= get ""

and I would like to know whether it is a problem of a prticular implementation of VR or it is a general problem that has no solution in a mutable type-infered language that doesn't include mutation in the type system.

© Stack Overflow or respective owner

Related posts about functional-programming

Related posts about type-inference