Live data from Hacker News

I learned Haskell in just 15 years

duckrabbit.tech

71–80 of 240 posts

Re: I learned Haskell in just 15 years

#71
post #17

Great read! Can anyone here recommend a good resource for learning Haskell that's in the style of "Text-Mode Games as First Haskell Projects"? Haskell has been on my radar since forever, and I've got some FP concepts internalized by making a side project in F#, but I have no idea what a monad really is and a fun prohect to code along might be perfect.

I've been learning Unison [1] and I highly recommend. It's a Haskell-like language, but with some really interesting ideas around how code should be managed and distributed. They also use use algebraic effects (represented with "abilities" in Unison) instead of Monads, which gives some interesting advantages [2]. [1] https://www.unison-lang.org/ [2] https://www.unison-lang.org/docs/fundamentals/abilities/for-...

Have you written anything in Unison yet? To me Unison feels extremely ahead of its time. They clearly thought things through and aren't afraid to challenge the status quo. Maybe a bit too much ahead of its time even...

I fear `ucm` a little. You mean I can't version my things with git? How do I... ehh, do anything? And how is the deployment story if one chooses not to use the Unison cloud?

Re: I learned Haskell in just 15 years

#72
post #3

Earlier quoted context omitted.

Yes - the value of functional programming isn't that working in OCAML, or F#, or Haskell is 10x as productive as other languages. But that it can teach you worthwhile lessens about designing software that apply equally to imperative languages. Modelling the business domain, reasoning and managing side effects, avoiding common imperative bugs, these are all valuable skills to develop. F# is a great language to learn,…

> Yes - the value of functional programming isn't that working in OCAML, or F#, or Haskell is 10x as productive as other languages. This is not true in my personal experience. As has been famously said (paraphrased): Functional programming makes tough problems easy and easy problems tough. In other words the value of functional programming depends on your domain.

What easy problems are tough in F#? I’ve been using it for writing random scripts and as a Python replacement.

Re: I learned Haskell in just 15 years

#73

Great read! Can anyone here recommend a good resource for learning Haskell that's in the style of "Text-Mode Games as First Haskell Projects"? Haskell has been on my radar since forever, and I've got some FP concepts internalized by making a side project in F#, but I have no idea what a monad really is and a fun prohect to code along might be perfect.

This may help? (Just an example of a monad pattern in use to build a burrito!)

https://www.williamcotton.com/articles/a-burrito-is-a-monad

Re: I learned Haskell in just 15 years

#74

Great read! Can anyone here recommend a good resource for learning Haskell that's in the style of "Text-Mode Games as First Haskell Projects"? Haskell has been on my radar since forever, and I've got some FP concepts internalized by making a side project in F#, but I have no idea what a monad really is and a fun prohect to code along might be perfect.

Haven’t you heard? Monads are burritos!

In all seriousness, it’s not “text mode”, but one of the things that I felt really showed how cool Haskell and a friend could pure model could be a was Netwire and Functional Reactive Programming. It allowed me to design graphical applications the way I always wanted to instead of how they’re typically structured in imperative languages. There are lots of tutorials out there for making little games with it.

Re: I learned Haskell in just 15 years

#75

Earlier quoted context omitted.

> Yes - the value of functional programming isn't that working in OCAML, or F#, or Haskell is 10x as productive as other languages. This is not true in my personal experience. As has been famously said (paraphrased): Functional programming makes tough problems easy and easy problems tough. In other words the value of functional programming depends on your domain.

What easy problems are tough in F#? I’ve been using it for writing random scripts and as a Python replacement.

Writing recursive descent parsers in F# is a lot of fun with ADTs and pattern matching.

Re: I learned Haskell in just 15 years

#76

Earlier quoted context omitted.

Doesn't the "O" in OCaml stand for "Object", though? I think you could pick up either F# or OCaml just as easily. The nuances of OOP in F# can be ignored by beginners, so I really wouldn’t let yourself be intimidated coming from Clojure. [0] https://ocaml.org/docs/objects

OCaml classes and objects are (ironically) rarely used and generally discouraged. There are some cases where they’re practically required, such as GUI and FFI (js_of_ocaml). But otherwise, most code does encapsulation and abstraction using modules and functor modules (which are more like Haskell and Rust typeclasses than traditional OOP classes). I don’t know much about F#, but last time I used it most of its standar…

F# uses .NET's generics, so the statement regarding List/Set is completely incorrect (all base collections are generic).

Re: I learned Haskell in just 15 years

#77

Earlier quoted context omitted.

I've actually had to fire a technically exceptional Haskell programmer because of the damage they did to our C# codebase (and arguably moreso, the team). Sometimes it's not a matter of talent or skill, but culture fit. In my experience FP-aligned people on non-FP projects tend to be more likely to overengineer, more prone to argue in favor of the Great Rewrite For No Reason Except Aesthetics, and more likely to abuse…

This is my experience, too. Some of the worst code I‘ve seen was a Haskell guy who first built his own (reactive?) concurrency framework and then implemented the actual functionality in completely unidiomatic and undocumented Java. Some people don’t understand that the „best solution“ is not necessarily equal to the most beautiful abstraction they can think of.

> Some of the best code I‘ve seen

There, fixed it for you.

But I have to be fair, whenever I see a demand for "idio(ma)tic code" I know that this is a place to avoid, no matter if they are imperatively or functionally inclined.

Re: I learned Haskell in just 15 years

#78
post #61

When Haskell was a hot topic around two decades ago, ML was also quite often discussed. Today ML almost only means machine learning

That's what I remember from my Computer Science classes 2001-2002. Standard ML was hard to learn back then for a newbie especially a Computer Science newbie.

Re: I learned Haskell in just 15 years

#79

Earlier quoted context omitted.

OCaml classes and objects are (ironically) rarely used and generally discouraged. There are some cases where they’re practically required, such as GUI and FFI (js_of_ocaml). But otherwise, most code does encapsulation and abstraction using modules and functor modules (which are more like Haskell and Rust typeclasses than traditional OOP classes). I don’t know much about F#, but last time I used it most of its standar…

F# uses .NET's generics, so the statement regarding List/Set is completely incorrect (all base collections are generic).

I think you misread their claim - they said that generic list/set would have to be classes, not modules (generic modules are a specific thing in OCaml and aren't the same as a module of generic classes).

Re: I learned Haskell in just 15 years

#80
post #25

What's the benefit of learning a PURE functional programming language, opposed to just using a language which has adapted the best bits and pieces from the functional programming paradigm? Given that you want write code that sees "real world" use, and is used to handle data and events from the real world. To me, sometimes the line between optimized code and intellectual curiosity blurs.

> What's the benefit of learning a PURE functional programming language 1. It makes it easy to learn how to structure a program in a pure way, which is hard to do in languages that offers you a easy way out. 2. Since "everything" is pure, writing tests is easier. 3. You know for certain that if you discard the result of a function call, all the side-effects that it would normally trigger would be stopped as well. 4.…

The problem with Haskell is that it's slow and memory-heavy (and OCaml is the same, but worse). F# and Scala (and Clojure?) are pretty much the only reasonably usable FP languages.
Post reply on HN