Yes, but it's called Choice<'a,'b>; there are additional Choice types with up to 7 type parameters.

By on 10/23/2010 7:26 AM ()

Can anyone supply some examples of using these canned types with or w/o active patterns? - when would I need (or fiind it convenient) to operate w/these types explicitly?

Thanks

By on 10/25/2010 10:20 AM ()

Thanks!

Wouldn't it be nicer (if there is just up to 7 items) those data constructors named like First, Second and so on?

By on 10/23/2010 7:54 AM ()

I don't love the ChoiceKOfN naming, but it has the advantage that you can write

1
(Choice3Of5 "test")

and the compiler can infer the type

1
Choice<'a,'b,string,'c,'d>

(that is, it knows that there are exactly 5 type parameters). On the other hand, if you used the same constructor names regardless of the number of type parameters, then

1
(Third "test")

could be an instance of

1
Choice<'a,'b,string>

,

1
Choice<'a,'b,string,'c>

, etc. In general, reusing constructor names causes problems.

By on 10/23/2010 9:43 AM ()

That's an effective convention! I'v learned a really useful tool today; Thanks to you! :)

And it was interesting to me that F# compiler has anything to do with symbol name strings?! First time I saw this in Go lang. where PascalCase names are public and camelCase names are private.

Is there anywhere else in F# that we have other conventions over name literals?

Thanks again!

By on 10/23/2010 12:43 PM ()
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