News for hackers. Stuff that matters.
Re:What I wish I knew when learning F# by dboreham on Thursday October 14, 2021 @12:42PM (#28866610)
I think enforced purity is problematic (although obviously useful for some purposes such as program correctness proofs). I still want to be able to write:

doThing1();

// thing1 has finished

doThing2();

Where the functions block. Async and Monads and Futures and all are useful for some things, but mostly I just want to do stuff sequentially, blocking, and not confuse myself.

Scala allows this, although the widespread Future-ification of libraries makes it hard to actually practice.

Re:What I wish I knew when learning F# by ghostwriter on Thursday October 14, 2021 @12:51PM (#28866727)
Haskell allows this too, users can just code everything within IO until they feel comfortable with adding extra purity through refactoring:

    main :: IO ()
    main = do
        myBusinessLogic
    
    myBusinessLogic :: IO ()
    myBusinessLogic = do
        doThing1
        doThing2

    doThing1 :: IO ()
    doThing1 = do
        putStr "Hello "

    doThing2 :: IO ()
    doThing2 = do
        putStrLn "World"

    ---
    ghc -o main main.hs
    [1 of 1] Compiling Main             ( main.hs, main.o )
    Linking main ...
     ./main
    Hello World
Re:What I wish I knew when learning F# by dboreham on Thursday October 14, 2021 @01:35PM (#28867364)
True. Perhaps my issue is that I know how that's implemented and my brain can't see it the same as sequential statement execution ;)
Re:What I wish I knew when learning F# by JoelMcCracken on Thursday October 14, 2021 @03:19PM (#28868731)
This is a function of familiarity though. Get familiar with it and you'll understand it just fine.

If you want to talk more about it, feel free to email me.

Re:What I wish I knew when learning F# by tome on Thursday October 14, 2021 @03:27PM (#28868828)
I think dboreham's objection was exactly the opposite!
Re:What I wish I knew when learning F# by JoelMcCracken on Thursday October 14, 2021 @03:56PM (#28869172)
Idk i mean simply knowing what the code for >> looks like doesn't mean you're used to thinking in that way.

There was a time years ago when someone was showing me the types of (>>) and (>>=) in Haskell and my question was "ok, but what does that have to do with IO?!?"