By on 1/26/2010 9:38 AM ()

type variables (ex: 'a) can not be used in pattern matching. In fact, the really can be used much at run-time. The compiler is automatically replacing your 'a with type obj, hence your matching issues. One approach might be a match against specific types of lists. For example...

1
2
3
4
match o with 
| :? int list -> printfn "its a list of int" 
| :? Foo list -> printfn "its a list of Foo" 
| _ -> printfn "I'm not sure what it is"

Of course, this type of solution may not be sufficiently "general" for the problem you are trying to solve.

By on 1/26/2010 9:10 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper