Can F # be reorganized in a style without glasses?

While researching a programming topic, I came across a pointfree refactoring tool for Haskell in lambdabot and wondered if F # could be refactored in a glasses-free style?

I'm not a fan of using the pointfree style, but I see it as a way to better understand the function.

Note: pad answered an earlier version of this question, but I reformulated this question as the answer matters to others by studying and using F #, and I did not want this to be deleted due to some close voices.

Note. Just because I changed the question, don’t accept the answer, to keep in mind that you cannot use dot-style code with F #. This can be done in many cases, but there are limitations that you must comply with.

+7
f # pointfree
source share
1 answer

Short answer

Not.

Long answer

F # has a few things that make such a tool impractical. (1) Due to .NET interop, F # code often has side effects, and automatic code conversion becomes really difficult when side effects occur. This is not so with Haskell; Equational reasoning is much simpler in Haskell, and you can rewrite left sides with right sides without changing their ratings. (2) Programming without points in F # is limited by the limitation of value . I'm not sure that you can do code conversion aggressively without affecting this problem.

I think it is more practical to assume that the F # code is clean, and the value restriction does not occur in some cases, so that we can give users some hints. Users can automatically apply offers after evaluating that the offers are truly correct. It is closer to HLint than the one you referenced. FSharpLint added some sorting rules in this direction.

+11
source share

All Articles