KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This active pattern compiles with F# 2.0: let (|Value|_|) value = // 'a -> 'T option match box value with | :? 'T as x -> Some x | _ -> None but, in F# 3.0, emits the error: Active pattern '|Value|_|' has a result type containing type variables that are not determined by the input. The common cause is a [sic] when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice = A x' I tried: let (|Value|_|) value : 'T option = ... and: let (|Value|_|) (value: 'U) = ... How can it be fixed? Environments: Visual Studio 2012 (RTM) and FSI v11.0.50727.1 EDIT: Here's a simpler repro: let (|X|) x = unbox x
Tags (comma-separated)
Save Edits
Cancel