How does one avoid "Value restriction" errors with F#'s Seq.cast?

Posted by gatoatigrado on Stack Overflow See other posts from Stack Overflow or by gatoatigrado
Published on 2010-06-07T22:50:27Z Indexed on 2010/06/07 22:52 UTC
Read the original article Hit count: 261

Filed under:
|
|
|
|

I see that Seq has a cast function from IEnumerable to Seq, but how do I get it to work?

open System.Text.RegularExpressions;;
let v = Regex.Match("abcd", "(ab)");;
Seq.cast (v.Captures);;

This produces,

error FS0030: Value restriction. The value 'it' has been inferred to have generic type val it : seq<'_a>
Either define 'it' as a simple data term, make it a function with explicit arguments or, if you do not intend for it to be generic, add a type annotation.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about F#