tags:

views:

192

answers:

2

I'm reading through a pretty swell wikibook on F#. At the bottom of the section on List Comprehensions, it explains that one can use an arrow operator instead of the yield/yield! keywords. But it notes that this is deprecated. I was wondering why?

+7  A: 

As far as I know, it's not deprecated as such - at least Visual F# 2010 documentation on MSDN still uses it. What was deprecated is some other syntax, which included -> and ->> in places other than simple for expressions. In particular, see this post by Don Syme - quote:

> and ->> are now deprecated except in the compact sequence expressions.

The two shorthands -> and ->> are now deprecated except in the sequence expression short form: seq { for x in c -> f(x) }. In all other sequence expressions, use the full names yield and yield!.

Pavel Minaev
+2  A: 

I think removing most uses of -> and ->> was done for consistency with C#. Personally, I think this is a mistake.

Haskell comprehensions are powerful partly because they are so succinct, just like set notation - the F# syntax ends up making things harder to understand because anything relatively complicated ends up being split over many lines.

RD1