Live data from Hacker News

I learned Haskell in just 15 years

duckrabbit.tech

171–180 of 240 posts

Re: I learned Haskell in just 15 years

#171
post #123

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." 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"…

The constraint here is "the best possible way".

Re: I learned Haskell in just 15 years

#172

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.

There's a video game on steam you can buy with real dollars built in Haskell. I work full-time writing Haskell. Fintech stuff. No shiny research going on here. I've written some libraries and programs on my stream in Haskell. One is a client library for Postgres' streaming logical replication protocol. I've written a couple of games. Working on learning how to do wave function collapse. Believe it or not, functional…

> There's a video game on steam you can buy with real dollars built in Haskell.

Link? Story?

Re: I learned Haskell in just 15 years

#173
post #95

Earlier quoted context omitted.

> They'll experience no friction when using Haskell then. The question was what benefit you'd get from learning a functional language, though. Existing knowledge making it easier to switch to a functional language is the inverse of that. And there's no assumption they'll actually be making things in Haskell, so easy switching isn't by itself a benefit.

Yeah I can't really follow these threads. I saw: > 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? I also saw: Though you can break purity with just inputs: define f(o): return o.x let a = {x=1} f(a) a.x = 2 f(a) I don't know if that's the tail-end of a reductio ad absurdum whic…

The topic is what you would learn from a pure functional language.

A) You can learn and enforce full purity in other languages. B) You could also learn and adapt just the idea of clean inputs and outputs to those other languages.

Both of those are valid answers! It's very hard to be completely pure if you're not currently using Haskell.

The way they worded things, I wasn't sure which one they meant. They were describing option B, but I didn't know if that was on purpose or not.

So I responded talking about both. Complete purity and just the idea of clean inputs and outputs.

That code snippet is not some kind of absurd argument or strawman, it's there to demonstrate how the description they gave was not a description of purity. It's not aimed at the original question.

Re: I learned Haskell in just 15 years

#174
post #165

Earlier quoted context omitted.

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

The world is much less black and white than you’d like to see it.

Functions in Haskell including Prelude can throw exceptions which is not reflected in the type signature of the function. That is an effect that makes seemingly pure functions impure.

You can’t judge a language from a list of buzzwords. You need to look at how it is used in practice.

Re: I learned Haskell in just 15 years

#175
post #172

Earlier quoted context omitted.

There's a video game on steam you can buy with real dollars built in Haskell. I work full-time writing Haskell. Fintech stuff. No shiny research going on here. I've written some libraries and programs on my stream in Haskell. One is a client library for Postgres' streaming logical replication protocol. I've written a couple of games. Working on learning how to do wave function collapse. Believe it or not, functional…

> There's a video game on steam you can buy with real dollars built in Haskell. Link? Story?

https://www.reddit.com/r/haskell/comments/z98ubk/comment/iyf...

Re: I learned Haskell in just 15 years

#176

Earlier quoted context omitted.

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.

Well, MS didn't have to do anything. It's enough that they have (or had) the opportunity to do something.

There isn't an Overmind in MS that in a creepy voice tells you to spawn more overlords. Less than that, there doesn't need to be a written document that tells you to give money to MS or your data etc. There's just a general accepted understanding among the people who run that company that ends justify the means. And by "ends" they mean them and their investors getting rich.

If Haskell compiler could've been turned into a money-making machine, and it only required killing off half of Haskell programmer, MS would be working overtime on the plan to hide the bodies, but they'd never even consider the possibility of killing being bad... (metaphorically speaking, hopefully)

Re: I learned Haskell in just 15 years

#177
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 really wanted to like F#, and I kinda do, but it has a number of quirks, compiler issues and cracks in the design that are getting worse:

First off, the compiler is single-pass. All your definitions have to be in order. This even extends to type hints - it can't use clues to the right to deduce the type of an expression on the left. This is supposedly for perf reasons, but the compiler can become extremely slow because the inference engine has to work so hard - slower than GHC for sure.

Speaking of slowness, Haskell is surprisingly fast. Idiomatic Haskell can be within 50% the perf of C, since its laziness and purity unlock powerful optimizations. F# is eager and the compiler doesn't do anything fancy. Perf often makes you reach for mutable state and imperative structure, which is disappointing.

The OOP paradigm feels bolted on. Should you use classes or modules? Pure functions or members? It depends, what mood are you in? Unfortunately only member functions support overloads, and overloads are useful for some SFINAE-type patterns with `inline` functions, so they get a bit overused.

`ref` struct support, which is vital for zero-copy and efficient immutable data, have very primitive support. even C# is ahead on this.

Very limited support for implicit conversions, no support for type classes and no function overloading leaves F# with nothing like a numeric tower you'd have in Lisp, and makes building something like Numpy clunky.

I use C# at work, and I love Haskell, so I really wanted to love F#. But it just doesn't get the love it needs from MS, and some design decisions aren't aging well - particularly as C# itself evolves in directions that are tricky for F#'s aging compiler to support.

Re: I learned Haskell in just 15 years

#178
post #174
post #165

Earlier quoted context omitted.

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

The world is much less black and white than you’d like to see it. Functions in Haskell including Prelude can throw exceptions which is not reflected in the type signature of the function. That is an effect that makes seemingly pure functions impure. You can’t judge a language from a list of buzzwords. You need to look at how it is used in practice.

> Functions in Haskell including Prelude can throw exceptions which is not reflected in the type signature of the function. That is an effect that makes seemingly pure functions impure.

No, bottom, or _|_, is an inhabitant of every lifted type. An exception is bottom. So the / function is still pure even though it can throw a divide-by-zero exception.

Re: I learned Haskell in just 15 years

#179
post #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 fo…

Ugh, autocorrect and it's too late to edit.

I was suggesting the Netwire library, an FRP library for Haskell.

Re: I learned Haskell in just 15 years

#180

Earlier quoted context omitted.

I was a college dropout and self taught bash and python programmer and quite some time ago, I read about Haskell, decided to teach myself to use it, and then realized I had absolutely no idea what programming actually was, and basically spent the next 15 years teaching myself computer science, category theory, abstract algebra and so on, so that I could finally understand Haskell code. I still don't understand Haskel…

> I still don't understand Haskell It's not you. Haskell has very bad syntax. It's not hard to understand it, it you rewrite the same things in something saner. Haskell was developed by people who enjoy one-liners and don't really need to write practical programs. Another aspect of Haskell is that it was written by people who were so misguided as to think that mathematical formulas are somehow superior to typical imp…

Just to give a different pov I find Haskell very intuitive, and particularly I find that code written by other people is very easy to understand (compared to Java or TypeScript at least).

And by the way x and x' are totally fine names for a value of a very generic type (or even a very specific type depending on the circumstances), as long as the types and the functions are decently named. I mean, how else would you call the arguments of

splitAt :: Eq a => a -> [a] -> [[a]]

?

There is no need for anything more complex than

splitAt x xs = ...

Post reply on HN