Live data from Hacker News

Show HN: I built a poker site with Haskell

github.com

11–20 of 121 posts

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

#13
post #8

Earlier quoted context omitted.

Haskell is dense. I'm picking it up now[0], so this project was very useful for me to see how some "real world" Haskell is written. But yes, take for example this function getSocketAPIPort :: Int -> IO Int getSocketAPIPort defaultPort = do maybeEnvPort return defaultPort Just port -> maybe (return defaultPort) return (readMaybe port) It gets a port from an environment variable, if it can, otherwise a default port. Co…

Though notice that you picked literally the most trivial example in the entire codebase that anyone can understand without explanation. Elm is onto something with its obsession with simplicity and lack of features. I go back to old Haskell code and have to completely recredentialize in Haskell before I remember what's going on. I return to old Elm code and need very little ramp up. I'm not making an "Elm > Haskell" a…

Do you have a better example from this code base? I'm looking but unfortunately I'm not seeing anything that isn't either trivial or just a lot of monad stack handling.

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

#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?

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

#15
post #8

Earlier quoted context omitted.

Haskell is dense. I'm picking it up now[0], so this project was very useful for me to see how some "real world" Haskell is written. But yes, take for example this function getSocketAPIPort :: Int -> IO Int getSocketAPIPort defaultPort = do maybeEnvPort return defaultPort Just port -> maybe (return defaultPort) return (readMaybe port) It gets a port from an environment variable, if it can, otherwise a default port. Co…

Though notice that you picked literally the most trivial example in the entire codebase that anyone can understand without explanation. Elm is onto something with its obsession with simplicity and lack of features. I go back to old Haskell code and have to completely recredentialize in Haskell before I remember what's going on. I return to old Elm code and need very little ramp up. I'm not making an "Elm > Haskell" a…

> Though notice that you picked literally the most trivial example in the entire codebase that anyone can understand without explanation.

I needed the explanation to understand what the code snippet was doing. Careful with those generalisations.

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

#16
post #5
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…

I think part of the problem is that Haskell code can be very terse. When reading Python I expect to be able to easily understand what's going on in a 5 line function because the pythonic style limits what you can do in 5 lines. But in haskell a 5 line function can be pretty sophisticated.

Careful about sweeping generalizations... The internet has shown what is possible in "one line" of python, and I've seen this in the real world scarily enough!

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

#17

Earlier quoted context omitted.

Though notice that you picked literally the most trivial example in the entire codebase that anyone can understand without explanation. Elm is onto something with its obsession with simplicity and lack of features. I go back to old Haskell code and have to completely recredentialize in Haskell before I remember what's going on. I return to old Elm code and need very little ramp up. I'm not making an "Elm > Haskell" a…

> Though notice that you picked literally the most trivial example in the entire codebase that anyone can understand without explanation. I needed the explanation to understand what the code snippet was doing. Careful with those generalisations.

Well, non-programmers are even more helpless in understanding the code, but that's just not the point I'm making. Let's not require everyone to couch every statement in disclaimers, especially such an ancillary one.

And you surely can understand that code is trying to read a port or use a default one.

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

#18
post #13

Earlier quoted context omitted.

Though notice that you picked literally the most trivial example in the entire codebase that anyone can understand without explanation. Elm is onto something with its obsession with simplicity and lack of features. I go back to old Haskell code and have to completely recredentialize in Haskell before I remember what's going on. I return to old Elm code and need very little ramp up. I'm not making an "Elm > Haskell" a…

Do you have a better example from this code base? I'm looking but unfortunately I'm not seeing anything that isn't either trivial or just a lot of monad stack handling.

Better examples of how Haskell can make the OP's eyes glaze over? Basically the rest of it.

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

#19

What would be the best IDE/editor for Haskell?

You can use a language server with Atom. Beware of stuff breaking (barely any ABI compatibility), and it taking like 12G ram, however.

Otherwise you can also integrate a language server with Vim or Emacs.

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

#20

Earlier quoted context omitted.

> Though notice that you picked literally the most trivial example in the entire codebase that anyone can understand without explanation. I needed the explanation to understand what the code snippet was doing. Careful with those generalisations.

Well, non-programmers are even more helpless in understanding the code, but that's just not the point I'm making. Let's not require everyone to couch every statement in disclaimers, especially such an ancillary one. And you surely can understand that code is trying to read a port or use a default one.

> And you surely can understand that code is trying to read a port or use a default one.

In programming languages which use paradigms I'm more familiar with, yes. In Haskell, not so much, which is the entire point of this thread.

Post reply on HN