Live data from Hacker News

Show HN: I built a poker site with Haskell

github.com

51–60 of 121 posts

Re: Show HN: I built a poker site with Haskell

#52

Earlier quoted context omitted.

Unfortunately, a lot of work there is done by the Haskell community having utterly absurd standards for those things. I work in a different functional programming language, and you would not believe the amount of time I spend convincing new hires with Haskell backgrounds to spend the extra few characters to expand out the unreadable point-free/single-character-names style that Haskell folks prefer.

Has it ever occurred to you that Haskell programmers prefer single-letter variable names in some contexts because it makes the code better? Perhaps it is not the children who are wrong.

Right, I find pointfree style to be much more readable than pointful, I expect the GP would too if they became used to it

Re: Show HN: I built a poker site with Haskell

#53
post #52

Earlier quoted context omitted.

Has it ever occurred to you that Haskell programmers prefer single-letter variable names in some contexts because it makes the code better? Perhaps it is not the children who are wrong.

Right, I find pointfree style to be much more readable than pointful, I expect the GP would too if they became used to it

The problem is you can’t bring that change about in a corporate setting by just doing things your own way and hoping your coworkers catch up. I think that’s more what GGP was having issue with.

Re: Show HN: I built a poker site with Haskell

#54

Dumb question. Is Haskell ever the best tool for the job? I feel that every language has a sweet spot, but Haskell seems to be a language that people use just to show that they can . I've always wanted to learn, but I don't want to learn if there isn't a reason to.

It’s arguably the best pure functional language implementation. So if you think functional programming is a good thing, then yes it’s worth learning. The worst part about Haskell is you realise how lacklustre functional programming is in every other hybrid language. The lisps probably come closest in capturing a similar feel.

Re: Show HN: I built a poker site with Haskell

#55
post #49

Earlier quoted context omitted.

Haskell is not a difficult language to learn, but unlike imperative languages, you can't just start reading the code if you "know literally nothing about Haskell". One thing to keep in mind is that every other line in Haskell is basically just composing functions together, but you need to know how all those weird >>= and and effect code/composition flow

> is not a difficult language to learn People say this about every single programming language.

dunno. to me PHP and CPP are the hardest, because I cant figure out the logic behind their design.

Re: Show HN: I built a poker site with Haskell

#56
post #7
post #3

Very neat! I've been working on a network application in Haskell too; this is a great reference. Is this project still active? Are there some features you'd like help developing?

Yes this project is active. That would be awesome if you contributed. There are a lot of features to add. Would you like me to add some of these to the issues on Github? Feel free to add your own suggestions to the issues as well.

That'd be great! I saw some todos, but you'll have the best perspective on what's important. I'm https://github.com/Gandalf-

Re: Show HN: I built a poker site with Haskell

#57
post #2

So, I know literally nothing about Haskell, and I would rate my knowledge of functional programming theory as 'beginner' at best, but I still get baffled every time when reading Haskell code that implements anything other than something trivial like a fibonacci sequence. The poker server code looks extremely tidy and well engineered, so that can't be the problem, but to me it's utterly incomprehensible. It seems like…

The nice thing about Haskell from a readability standpoint is to unpack what code does at any point, you only have to perform substitution (i.e. beta reduction) over and over. This is a key difference from most other programming languages, which require you to have a little VM in your head. "Localized reasoning" is what Haskellers call this.

To read it quickly, you do have to learn & internalize abstractions. Both a common set of them (the usual type classes) & abstractions custom-built in your project. Abstractions in Haskell tend to be true abstractions & not encapsulations. You don't necessarily need to know the internals to understand the abstraction. I've seen this put off systems programmers before (people used to writing C etc and understanding the assembly).

I wouldn't expect someone with no Haskell knowledge to understand Haskell code. I've seen higher-level people (e.g. VPE-level) get upset by this and knee-jerk decide Haskell is problematic. I'm of the opinion that such knee-jerks aren't worth listening to..I don't care about opinions of people who haven't met (or honestly tried to meet) the prerequisites.

Regardless, I will say as someone who has learned Haskell: Once you learn it, it becomes so stupid easy to do everything. I feel like I can solve more complex problems faster & better in Haskell than other programming languages I have comparable (or more!) experience in.

Re: Show HN: I built a poker site with Haskell

#58
post #14

Trying to read Haskell code without any knowledge of it is interesting to say the least. I like how compact it looks, but I'm guessing a lot of the simple looking statements (at least at first glance) do a lot under the hood. Is that a characteristic of Haskell itself or just the developer has a good style?

In Haskell vs other languages, a large amount of your program is written using various forms of composition (function composition, applicative/monadic composition [sequencing of side-effects], monoidal composition [combining values], library-specific composition [e.g. Conduit =$=] etc).

The stuff you compose tend to be small functions that are easy to test & reason about.

The nice thing about composition in Haskell is that if you have correct program A & B, then the composition of A & B is also correct & easy to reason about.

Re: Show HN: I built a poker site with Haskell

#59

Dumb question. Is Haskell ever the best tool for the job? I feel that every language has a sweet spot, but Haskell seems to be a language that people use just to show that they can . I've always wanted to learn, but I don't want to learn if there isn't a reason to.

Once you get over the learning curve, Haskell becomes the best tool for most jobs. The main reason I've _not_ used it is ecosystem (e.g. if Go or something has a library for some API that Haskell doesn't)

For instance, you could make a video game in Haskell. It has SDL2 bindings, plenty of networking libraries, best-in-class support for DSLs (user scripting), and you can even write the music for your game itself in Haskell!

Re: Show HN: I built a poker site with Haskell

#60

Earlier quoted context omitted.

tbf, I (as a person with some very basic haskell understanding) can more or less read the parent's code, but can't make heads or tails out of yours. "Convoluted and redundant" is in the eye of the beholder I guess

Is it? There's no part of you that looks and that and wonders why it's stuffing return into every leaf of a branching structure instead of just leaving it at the root? That's just objectively redundant. And there's no part of you that's wondering why it's using nested branches to implement the railway oriented programming pattern? That's just objectively more convoluted than using the combinators that abstract that o…

Yes, Haskell is the one language where you can always invest some more time learning something more advanced that will provide you a large boom in productivity.

That has the downside that Haskell developers speak many different idioms, just like Lisp. I'm prone to claim that the code you posted is basic enough that we can consider that people that don't get it are not proficient on the language yet, but there are way too many things right on the fence for that, and they can't all be required.

Post reply on HN