Live data from Hacker News

Haskell in Production

felixmulder.com

91–100 of 242 posts

Re: Haskell in Production

#91

Earlier quoted context omitted.

What exactly is wrong with it? I've never even used the Scotty library or monad being used and I can understand it.

1. I have a vague idea what the second "do" is for. I don't have the slightest idea what the first "do" does. 2. I have some idea what "$" is, but I have no idea what it does in this context. 3. param "uri" is presumably extracting a parameter, presumably from the result of an incoming HTTP request. How is that request passed into "app"? How is it passed into the "get"? How is it passed to "param"? 4. Why does "parse…

Look, I sympathize with you because Haskell is not easy to learn by any means so I understand someone not liking it. If I get time later I'll go item-by-item and explain. There's a lot of questions there but it's actually just a few fundamental concepts.

But I've seen engineers with only C/C++ experience get onboarded and write code with the same concepts & more complicated ones as the link shortener above. The key was onboarding by someone who knew Haskell well. Haskell companies need a culture of learning _and_ teaching to truly thrive and counteract downsides of the language like hiring pool and learning curve.

Re: Haskell in Production

#92
post #74
post #26

Earlier quoted context omitted.

>but what's wrong with the syntax? I'll just link to this blog about readable Haskell. If everyone followed his advise, it would be much better. http://www.haskellforall.com/2015/09/how-to-make-your-haskel...

Note that this is to make Haskell more readable to non-Haskell programmers (which is a bit of a weird goal IMO). It is not for readable Haskell in general. Advice like "not using $" just makes code less readable if you're familiar with Haskell and is quite frankly just bizarre. I do not think you'll find many programmers, Haskell or otherwise, who find lots of nested parenthesis to be the paragon of readability.¹ If…

> Honestly this sentiment from the Haskell community that Haskell is somehow bizarre and impenetrable to outsiders

They’re not inventing that from thin air. I can understand Haskell with a great deal of effort, but it certainly requires a great deal of effort.

My wife is a non-programmer. She knows nothing about code. I could explain what the go code I write does in a few minutes and she could follow it with a minimum of hand waving. I don’t think I could explain any non trivial Haskell code in hours to even professional programmers

Re: Haskell in Production

#93

All the interesting code is in the next post, http://felixmulder.com/writing/2019/10/05/Designing-testable... . I'm not sure why they use a generic monad rather than ST, they don't need continuations for this. The Reader monad with a big record is standard Haskell, it's basically what GHC uses: https://github.com/ghc/ghc/blob/1219f8e8a3d1b58263bea7682232... data-has is less standard, it only seems to have been used s…

The capability pattern that Data Has implements is definitely used in other projects[1], and notably is endorsed by RIO[2].

[1]https://github.com/input-output-hk/cardano-sl

[2]https://github.com/commercialhaskell/rio#monads

Elaboration: https://www.parsonsmatt.org/2018/03/22/three_layer_haskell_c...

Re: Haskell in Production

#94

Earlier quoted context omitted.

> Sounds like you've barely programmed in Haskell and don't know what you're talking about. You're right. I do not subject myself to Haskell because I can't fathom a world where JavaScript is less efficient than Haskell.

> I can't fathom a world where JavaScript is less efficient than Haskell. You can't fathom a world where a compiler can more easily produce efficient machine code from a statically typed language with very few semantic corners than from a dynamically typed language with lots of sharp corners plus reflection? I think you may need to meditate on the task of compilation a for a bit. Unless you mean efficient for the pro…

Efficient use of time I think the parent poster was referring to.

You could have the project finished quickier in Javascript. Would you disagree? Does choosing haskell increase development time (ignoring major rewrites)?

Re: Haskell in Production

#95

All the interesting code is in the next post, http://felixmulder.com/writing/2019/10/05/Designing-testable... . I'm not sure why they use a generic monad rather than ST, they don't need continuations for this. The Reader monad with a big record is standard Haskell, it's basically what GHC uses: https://github.com/ghc/ghc/blob/1219f8e8a3d1b58263bea7682232... data-has is less standard, it only seems to have been used s…

It's always good to see examples of how a language is actually used, rather than just assertions of its superiority. That said, if Haskell programmers truly consider this a superior and readable way to write code would tend to reinforce my preconception of them as an insular community elevating arcane jargon to a virtue (not unlike the APL programmers of yore).

Its strange how code written in unfamiliar languages is ... unfamiliar? The Haskell in that post is bog-standard. The definition of "arcane" is not "I don't know it".

Re: Haskell in Production

#96
post #63

We are a YC company doing very well, all our back end code is written in Haskell. We have produced a lot of functionality with a relatively small team. I would say we are existence proof that Haskell is good for business.

For the problem you are solving and at your scale. Things start to change when you need to hire n+1 teams or engineers quickly.

Re: Haskell in Production

#97
post #82

Earlier quoted context omitted.

I have taught both Haskell and Java and there is no comparision in difficulty. Teaching basically all of the Java language can be done in a couple of days (excepting generics, which take another day or two), and the language bugs are always "shallow". Haskell on the other hand creates crazy errors which confuse students, and often require extensive teaching to understand what is going on. I'm happy to accept the poss…

What kind of error would you like to see here instead ?

Maybe just one extra line like this?

    Prelude> print 2 + 3

    :3:1: error:
        • No instance for (Num (IO ())) arising from a use of ‘+’
        • The expression `print 2` :: IO ()
        • In the expression: print 2 + 3
          In an equation for ‘it’: it = print 2 + 3
Just adding the one line telling telling you what was `IO ()` is helpful. ghci obviously knows what it was here.

Re: Haskell in Production

#98

Earlier quoted context omitted.

What exactly is wrong with it? I've never even used the Scotty library or monad being used and I can understand it.

1. I have a vague idea what the second "do" is for. I don't have the slightest idea what the first "do" does. 2. I have some idea what "$" is, but I have no idea what it does in this context. 3. param "uri" is presumably extracting a parameter, presumably from the result of an incoming HTTP request. How is that request passed into "app"? How is it passed into the "get"? How is it passed to "param"? 4. Why does "parse…

Could be a fun game. I'll guess. No haskell knowledge. PHP background.

1. Connect to remote connection. DO - wait..

2. $ Loop-over

3. It comes from a config file with a hardcoded value and is globally included

4. Because it could be reused to handle a different types.

6. Text is printing to standard output.

7. Creating and Repointing the response to the resp var

Re: Haskell in Production

#99

Earlier quoted context omitted.

Thanks. That's a good blog. The $ operator is definitely confusing in Haskell. F# uses print This means: Take the result of 4 * 2 and send it to `even`, then take that result and send it to `print`. Or you can write it with forward pipes to make it even clearer: 4 * 2 |> even |> print The thing about backward pipes is that they're often used to avoid parentheses, which is IMHO a good idea. It's just that thinking of…

> Does (g ∘ f)(x) mean g(f(x)) or f(g(x))? The function composition operator can be vocalized as, in this case, "g after f". That is, apply the f and then g. Translating '∘' into 'after' is the easiest way to understand it.

Alternatively, I learnt it as "of" (from a mathematical standpoint). "(g ∘ f)(x) " is "g of f of x", so g(f(x))

Re: Haskell in Production

#100

Earlier quoted context omitted.

It's always good to see examples of how a language is actually used, rather than just assertions of its superiority. That said, if Haskell programmers truly consider this a superior and readable way to write code would tend to reinforce my preconception of them as an insular community elevating arcane jargon to a virtue (not unlike the APL programmers of yore).

Its strange how code written in unfamiliar languages is ... unfamiliar? The Haskell in that post is bog-standard. The definition of "arcane" is not "I don't know it".

I've worked in a pretty wide range of languages. I think I know "unfamiliar" and I can tell it apart from "arcane".

OP claims that "this article will emphasize writing easy to grok, maintainable code". The definition of "easy to grok" is not "once you've bought into the entire mindset, this will be obvious to you".

Post reply on HN