Live data from Hacker News

I learned Haskell in just 15 years

duckrabbit.tech

161–170 of 240 posts

Re: I learned Haskell in just 15 years

#161
post #2

Cute. All kidding aside, though, functional programming is worth the effort to learn, and it doesn't actually take 15 years. The payoff is at the end of the article: "It’s quite natural to program in Haskell by building a declarative model of your domain data, writing pure functions over that data, and interacting with the real world at the program’s boundaries. That’s my favorite way to work, Haskell or not." Haskel…

I would recommend neither of those. Haskell has very bad syntax (with extensive backing from Microsoft, iirc the guy who writes the compiler is a Microsoft's Research employee). F# is a straight-up Microsoft's language. It doesn't matter what other benefits it has. Just don't touch anything created by that company, and you will have one fewer regrets in your life. But, if you still want a language from that category:…

SPJ has left MSR and is now at Epic games, working on a new PL. However, even while he was at MSR, MS didn't really have a say in how Haskell was developed.

Re: I learned Haskell in just 15 years

#162
post #71

Earlier quoted context omitted.

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?

Can you or someone else familiar with Unison tell us what specific things about Unison feel ahead of its time? I don't know Unison so these things will be a good motivation for me to learn Unison.

Unison tries to swallow the whole elephant all at once, which is probably what the author is getting at.

* `ucm` is like a coding assistant that sits with you the whole time. You don't grep through code to find snippets or anything, you use `ucm`. It does a whole lot more, but that's just the trivial example.

* You need `ucm` because Unison stores code as a syntax tree, not text. This is awesome because versioning/dependency conflicts/rename issues just go away. This is not awesome because nothing else knows how to understand this: other source control systems will just not work.

* It's really trying to drag functional coding into this decade and what we use code for in production. It's not trying to be Haskell which is a great language, but doesn't (to me) feel like it was designed to do something like a simple web app.

* It is supposed to do distributed cloud computing without modification (this smells like where the VC money came from), but again, you have to use their platform because other clouds don't understand Unison.

The list goes on.

Each individual piece of Unison I think is really great. I love the `ucm` model of having an assistant sit next to you the whole time. What I don't love is that there is just _so much_ learning placed on the developer. To understand Unison, you need to understand a lot of what they're doing, a lot of what they are doing is novel, and so you have to eat the whole elephant that they are. I don't know if there was a path where they could have eaten the elephant one bite at a time, but it really makes the onboarding onerous.

Re: I learned Haskell in just 15 years

#163
post #2

Cute. All kidding aside, though, functional programming is worth the effort to learn, and it doesn't actually take 15 years. The payoff is at the end of the article: "It’s quite natural to program in Haskell by building a declarative model of your domain data, writing pure functions over that data, and interacting with the real world at the program’s boundaries. That’s my favorite way to work, Haskell or not." Haskel…

In modern Fortran, functions should be pure (although the language does not require this), and procedures that mutate arguments are made subroutines (which do not have return values).

Note that Fortran's interpretation of the term "pure" bizarrely allows a "pure" subprogram to depend on mutable state elsewhere (in a host, a module, or a COMMON block). So Fortran's "pure" functions aren't referentially transparent.

(F'2023 added a stronger form of "pure" and calls it "simple", but it didn't strengthen the places where a "pure" procedure should be required to be "simple", such as DO CONCURRENT, so being "simple" will be its own reward, if any compiler actually implements it. And a "simple" function's result value can still depend on a mutable pointer target.)

Re: I learned Haskell in just 15 years

#164
post #114

Earlier quoted context omitted.

How do you “Hello World” in a functional language? Doesn’t it have side effects?

The string "Hello World" evaluates to itself, what else do you need? Edit: Eh, I thought it was a fun quip.

I laughed

Re: I learned Haskell in just 15 years

#165
post #92

Earlier quoted context omitted.

C++ explicitly supports memory-safe programming. You can choose whether you want to mess around with raw pointer arithmetic. What safeguards does the language actually put in-place?

> C++ explicitly supports memory-safe programming. You can choose whether you want to mess around with raw pointer arithmetic. I don't think you know what you're talking about. Managing object ownership through systems like smart pointers is not memory safety. Applications that use smart pointers still suffer from memory issues, and it's possible to adopt object ownership systems that still use raw pointers, such as…

> I don't think you know what you're talking about.

Right. I sound just like someone talking about how "a language which emphasizes immutability" is an OK replacement for a language with pure functions.

Re: I learned Haskell in just 15 years

#166

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).

F# has "generics" just like Python and PHP now "have types".

It's not a yes/no feature.

Re: I learned Haskell in just 15 years

#168

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.

In my experience, I only really learned how to write small functions after Haskell. The discipline it forces on you is a good training.

Re: I learned Haskell in just 15 years

#169
post #166

Earlier quoted context omitted.

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

F# has "generics" just like Python and PHP now "have types". It's not a yes/no feature.

Give F# a try. It has, and always had, true generics.

https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...

Re: I learned Haskell in just 15 years

#170
post #123
post #99

Earlier quoted context omitted.

In theory, you could pick up your one language, say, Java, and through the course of a normal career learn everything necessary to program in that language in the best possible way. In practice, it's a pretty well-known phenomenon experienced by many skilled programmers that being forced into different styles by different languages results in learning things that you would only have learned very slowly if you had stu…

"In theory, you could pick up your one language, say, Java, and through the course of a normal career learn everything necessary to program in that language in the best possible way." OK, then you know about currying, immutable data structures, map/reduce/filter, &c. Because Java has that since way back when. No real closures, I think, but that doesn't matter much because the anonymous functions do what you want pret…

> OK, then you know about currying, immutable data structures, map/reduce/filter, &c.

It's not a certainty you learn about those things from Java, depends on your team/manager/codebase. None of that is enforced in Java the way it is in fp. Plus, none of it is really core or native to Java, it was added on later.

That's how we got essays back in the 2000s like "The Perils of Java Schools", "Can Your Language Do This", and "Beating the Averages".

https://www.joelonsoftware.com/2005/12/29/the-perils-of-java...

https://www.joelonsoftware.com/2006/08/01/can-your-programmi...

https://paulgraham.com/avg.html

Post reply on HN