1. 27
  1.  

  2. 9

    I had a horrible time learning Haskell until Get Programming with Haskell. I hadn’t even managed to get to the point where I wrote an actual executable program before that book, but I did nearly every exercise in it, and even wrote a tool I needed at the time: dumping the blocks in a PNG.

    The biggest benefit I got was understanding better the functional programming side of Rust and its Haskell influences (like #[derive).

    1. 4

      Haskell is awesome in all senses of the word. While all types of applications can be written in Haskell, there are some areas where it’s better suited. It’s amazing for applications that take in data in one end and spits out data in the other end. This mirrors the behavior of pure functions.

      But viewing time and user input as what goes in in one end and pixels going out in the other end is stretching what Haskell is suitable for. Like for 3D FPS games. It’s doable, but to me, it’s a very unintuitive way to deal with both users and pixels, compared to a language that is centered around objects and state.

      Include the idea that the real world is dirty, users are dirty, output is dirty and the uninutitiveness doubles.

      I still think Haskell is awesome though (and have used it in production).

      1. 8

        You may be surprised by how nice it can work for building UIs, especially with a declarative library. I’m thinking of Brick for terminal UIs, which I’ve used a couple times. Each time it ended up looking a lot like react+redux, with a fn that takes state + action, state changes, and the UI is updated off the state.

        Concur-replica looks interesting for web UIs, being a phoenix-liveview but for haskell. I think we’ll see many more of these, since updating via html over a websocket seems to be a little hot right now.

        In a way they’re both taking the UI problem and reframing it as a data in, data out problem, hiding all the dirty stuff like diffing, updating, and user input.

        1. 6

          But viewing time and user input as what goes in in one end and pixels going out in the other end is stretching what Haskell is suitable for. Like for 3D FPS games. It’s doable, but to me, it’s a very unintuitive way to deal with both users and pixels, compared to a language that is centered around objects and state.

          Check out godot-haskell. Works beautifully and is very performant. There’s nothing wrong with writing Haskell code on top of a 3D engine that is very imperative and loves objects. You get a lot of cool type safety that you don’t get anywhere else.

          1. 1

            godot-haskell sounds like the best of both worlds. I’ll check it out, thanks.

          2. 3

            But viewing time and user input as what goes in in one end and pixels going out in the other end is stretching what Haskell is suitable for.

            Have you considered FRP (functional reactive programming)? It models these UI cases well in Haskell; Reflex being a well-known library for it. I’ve written web apps and desktop apps using FRP in Haskell.

          3. 2

            Between 1998 (when a friend that was doing his MSc with the Haskell team) and 2020 I tried three times to seriously learn Haskell. I failed. I do understand the benefits of knowing about it, but all three efforts depressed me a lot.

            That being said, I am not advising anyone against learning it.

            1. 4

              I failed twice before succeeding. It is very normal. For me, https://haskellbook.com did the trick. It is slow and involves a lot of exercises, but it actually made it pretty easy in the end.

              Also, I joined a company with some Haskell devs who helped me stay motivated. I think instead you can just join the FP slack or discord to get help.

              1. 2

                Seconding the FP Slack, it’s a really friendly place with a bunch of different communities. The fp-ts author hangs out there for example.

              2. 4

                i’ve tried and failed 3 times in 3 years, and the 4th time it clicked :)

                1. 3

                  Come to the #haskell IRC channel and ask questions? I’ve seen many people succeed in learning Haskell that way! It worked for me!