#Favorite F# Features?

1 messages · Page 1 of 1 (latest)

reef mountainBOT
#
Favorite F# Features?

(from Reddit)

I'm writing a language inspired by Rust and F#, it compiles to native (and can also be interpreted). I've got ADTs (and Rust like error handling), and the forward pipe operator ("|>") from F#.

But it's been a while since I used F# on a daily basis. What features do you adore, and wish you could find in the language you otherwise use?

#
Favorite F# Features?

(from Reddit)

So far, everything, coming from c#. :)

#
Favorite F# Features?

(from Reddit)

What is the language's target and will it have a garbage collector? My suggestion depends on your response to this.

#
Favorite F# Features?

(from Reddit)

- Note that F# has custom operators. The pipe operator isn't special, and its definition can be found in the core library.

https://github.com/dotnet/fsharp/blob/main/src/FSharp.Core/prim-types.fs#L4546-4546

- Consider currying vs partial application shorthand. F# has currying, but I think either is fine.

- Higher order functions are essential.

- Deterministic inlining can be nice. F# uses it extensively.

- Hindley-Milner type system.

- Something similar to computation expressions. Also look at `do notation` in Haskell.

- If you want to get fancy add some kind of support for HKTs. F# does this through SRTP, but it's clunky and the error messages are horrible.

reef mountainBOT
#
Favorite F# Features?

(from Reddit)

Discriminated unions

#
Favorite F# Features?

(from Reddit)

Method overloads

#
Favorite F# Features?

(from Reddit)

Already built in :-). Absolutely essential.

#
Favorite F# Features?

(from Reddit)

I probably won't do this one, but I will keep it in mind. It offers some real power, but I tend to view allowing any sort of DSL power as something that makes it harder to understand. How many DSLs might one need to learn on top of the language itself?

In F# this hasn't felt like a problem, but I noticed it when looking at Nim's ecosystem.

#
Favorite F# Features?

(from Reddit)

Ability to pass parameters by name, such that currying and partial application can still work.

Remaining parameters continue in the same order.

Also Higher Kind Types like Haskell. Trying to do DI with multiple interfaces into a custom CE gets messy and is difficult to get working using SRTP.

#
Favorite F# Features?

(from Reddit)

Something like the Hindley-Milner system, and higher order functions. I don't want to get fancy - I want a balance of simplicity and power.

#
Favorite F# Features?

(from Reddit)

Yes it will be GC'd. Target as in compilation target? Native binaries like Go produces (but with a small runtime).

#
Favorite F# Features?

(from Reddit)

I don't see a big difference between learning APIs and DSLs.

#
Favorite F# Features?

(from Reddit)

Strict dependency order. It's a bit wild because it seems to be a limitation at first, but it's actually one of the best tools to keep your project well organized.

#
Favorite F# Features?

(from Reddit)

If you do not introduce a means for metalingustic programming, your users will do so and it will be half-assed and buggy instead of a well-thought out design.

#
Favorite F# Features?

(from Reddit)

Since you are not constrained by .NET, I would suggest looking into linear types :))

reef mountainBOT
#
Favorite F# Features?

(from Reddit)

Strict dependency order. Also interoperability with an existing established framework

reef mountainBOT
#
Favorite F# Features?

(from Reddit)

Really good generic type inference.

reef mountainBOT
#
Favorite F# Features?

(from Reddit)

So far, everything, coming from Java. :)