KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Can anyone explain why the second example below won't compile? 'Test 2' gives "error FS0670: This code is not sufficiently generic. The type variable ^a could not be generalized because it would escape its scope.". I fail to understand this error message. // Test 1 type test1<'a> = | A of 'a with override t.ToString() = match t with | A a -> a.ToString() // Test 2 type test2<'a> = | A of 'a with override t.ToString() = match t with | A a -> string a // Test 3 type test3<'a> = | A of 'a with override t.ToString() = match t with | A a -> string (a :> obj)
Tags (comma-separated)
Save Edits
Cancel