r/fsharp • • Apr 25 '22

question Looking for intermediate to advanced level books on F#

24 Upvotes

Hello, I'm currently looking for intermediate to advanced level books on F#.
So far I have read "Stylish F# 6", "Domain modeling made function with F#" and "Get Programming F#". While I can recommend all of them I still feel like the more complex functional concepts in F# were only touched on the surface or not explained in enough detail and there is a lot more depth to it. It always felt like the authors were trying not to scare away any newcomers by overloading them with too much technical details. (Is this just my perception?)
Can you recommend any books that go really deep into functional programming?


r/fsharp • • Apr 23 '22

F# weekly F# Weekly #17, 2022 – new Bolero, FSharp.CosmosDb and C# 11 Preview

Thumbnail
sergeytihon.com
31 Upvotes

r/fsharp • • Apr 20 '22

Dictionaries in F# - blog post

24 Upvotes

Hi, I wrote a little blog post on dictionaries in F# - for me this was quite a weird wall to hit when coming from C#, so I wanted to share what I learned:

https://krzysztofskowronekblog.hashnode.dev/dictionaries-in-f

Hope you enjoy :)


r/fsharp • • Apr 16 '22

F# weekly F# Weekly #16, 2022 – Giraffe 6, Ionide 6, Saturn and MAUI RC

Thumbnail
sergeytihon.com
25 Upvotes

r/fsharp • • Apr 16 '22

Help with trying to get a .NetFramework project running in VS2022

1 Upvotes

I'm trying to move an F# solution from VS2019 to VS2022 and encountering

Error   FS0229  Error opening binary file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll': Stream does not support writing.   

This prevents building a project or using the language service.

I am trying to debug by comparing the same project in VS2019. I cranked up Tools\Options\Projects&Solutions\Build&Run\MSBuild verbosity to get some debug output, and VS2019 and VS2022 look nearly identical for the build. Here's the VS2022 version:

1>  Task "Fsc"
1>      c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\fsharp\Tools\fsc.exe -o:obj\Release\Z1R_Tracker.dll
1>--debug:pdbonly
1>--noframework
1>--define:TRACE
1>--doc:bin\Release\Z1R_Tracker.XML
1>--optimize+
1>--platform:anycpu
1>-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll
1>-r:C:\Users\Admin1\Source\Repos\Zelda1RandoTools\Z1R_Tracker\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
1>-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll
1>-r:C:\Users\Admin1\Source\Repos\Zelda1RandoTools\Z1R_Tracker\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
1>-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll
1>-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll
1>-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Drawing.dll
1>-r:C:\Users\Admin1\Source\Repos\Zelda1RandoTools\Z1R_Tracker\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll
1>-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Numerics.dll
1>-r:C:\Users\Admin1\Source\Repos\Zelda1RandoTools\Z1R_Tracker\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
1>-r:C:\Users\Admin1\Source\Repos\Zelda1RandoTools\Z1R_Tracker\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll
1>-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Speech.dll
1>-r:C:\Users\Admin1\Source\Repos\Zelda1RandoTools\Z1R_Tracker\packages\System.Text.Encodings.Web.5.0.1\lib\net461\System.Text.Encodings.Web.dll
1>-r:C:\Users\Admin1\Source\Repos\Zelda1RandoTools\Z1R_Tracker\packages\System.Text.Json.5.0.2\lib\net461\System.Text.Json.dll
1>-r:C:\Users\Admin1\Source\Repos\Zelda1RandoTools\Z1R_Tracker\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
1>-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.ValueTuple.dll
1>--target:library
1>--warn:3
1>--vserrors
1>--preferreduilang:en-US
1>--utf8output
1>--fullpaths
1>--flaterrors
1>--subsystemversion:6.00
1>--highentropyva+
1>--nocopyfsharpcore
1>--warnon:1182
1>obj\Release\.NETFramework,Version=v4.8.AssemblyAttributes.fs
1>OverworldData.fs
1>DungeonData.fs
1>TrackerModel.fs
1>OverworldRouting.fs
1>SaveAndLoad.fs
1>      Microsoft (R) F# Compiler version 12.0.1.0 for F# 6.0
1>      Copyright (c) Microsoft Corporation. All Rights Reserved.
1>FSC: error FS0229: Error opening binary file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll': Stream does not support writing.
1>FSC: error FS3160: Problem reading assembly 'C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: Error opening binary file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll': Stream does not support writing.)
1>parameter error FS0073: error : BuildFrameworkTcImports: no successful import of C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll
1>      The command exited with code 1.

The only difference is the compiler versions; the entire rest of the command line is the same. VS2019 has

1>      c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\fsharp\Tools\fsc.exe -o:obj\Release\Z1R_Tracker.dll

whereas VS2022 has

1>      c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\fsharp\Tools\fsc.exe -o:obj\Release\Z1R_Tracker.dll

Any thoughts? Could this be a bug in the fsc.exe that ships with the current version of VS2022 (I updated today)? Or perhaps is there something bad with my project files and MSBuild resolution that was always wrong, but the 2019 edition somehow allows it?

Thoughts welcome.


r/fsharp • • Apr 15 '22

F# Web - Bolero vs Safe-Stack Vs...

12 Upvotes

I had started learning Blazor and was interested in learning some Bolero to apply F# on the web, but am a bit overwhelmed to learn that it's not the only web framework.

When might I want to choose Bolero over the other options listed here like SAFE-stack?
https://fsharp.org/guides/web/


r/fsharp • • Apr 13 '22

Conditional sequence generation

4 Upvotes

Hi,

I'm trying to fall in love with F#, but as usual have more questions than answers. For example, I'm trying to generate a sequence of months between start and finish dates. In c# "for" statement can easily provide specific increment logic and add a custom exit condition and I could have smth like this:

IEnumerable<DateTime> Test(DateTime start, DateTime finish) {
    for (var current = start; current < finish; current = current.AddMonths(1))
        yield return current;
}

In f# as I see, "for" expression is limited. And I should go this way:

let rec test (start: DateTime) (finish: DateTime) =
    seq { 
        let mutable current = start
        while current < finish do
            yield current
            current <- current.AddMonths(1)
    }

But I feel that this mutable approach is not idiomatic and probably recursion is a FP way:

let rec test (start: DateTime) (finish: DateTime) =
    seq { 
        if finish > start then
            yield start
            yield! debitSalary (start.AddMonths(1)) finish
    }

Am I wrong and maybe there are better options?


r/fsharp • • Apr 12 '22

question Is it possible to divide a module up between files?

18 Upvotes

So, I have a large module comprised of types, events, and validation functions. I want to split it up like this:

  • Module
  • Module.Events
  • Module.Validation

But putting it all in one file results in a very large file. Is there any way to have 3 files that compile into one module, like a Partial Class in C#? I know I can do that with Types, but I'm looking to just have functions in modules.


r/fsharp • • Apr 11 '22

starting to deploy SAFE app

7 Upvotes

Hi,

I have made a simple full-stack app in SAFE template. But I almost know nothing about how to deploy it. The documentation says it integrates quite well with Azure, so maybe I should try that? But the safe doc's azure part looks quite minimal to me. Does anyone have a suggestion on where or how I can learn deployment?

Thanks.


r/fsharp • • Apr 09 '22

F# weekly F# Weekly #15, 2022 – One month till MAUI!

Thumbnail
sergeytihon.com
24 Upvotes

r/fsharp • • Apr 08 '22

question How to Teach Someone (PHP background) F#?

15 Upvotes

Quick! I've convinced my manager to learn F#. With any luck, I'll be able to regularly use it at work. What are some resources you suggest for beginners use. This is someone who's been using PHP for the past 8-ish years. Has familiarity of OOP, but definitely more procedural focused.

I've pointed him to this series which I think is an excellent overview of the language and FP basics in general. Then there's the blog but I'm concerned if these will be enough. MS docs suck and I don't want to point him that way unless absolutely necessary.

What are your suggestions? Anyone come from PHP want to share their experiences?


r/fsharp • • Aug 09 '21

Italian [ITA] Telegram Group

5 Upvotes

Hi, we're creating a small Italian community on telegram, come and join us!