Live data from Hacker News

I tried Haskell for 5 years

metarabbit.wordpress.com

61–70 of 273 posts

Re: I tried Haskell for 5 years

#61
post #26

Earlier quoted context omitted.

Every time I've tried to dedicate time to really learning Haskell, I've come away with the feeling, "If I was a lot smarter or had a lot more time to dedicate to it, this would be a fantastic language to develop in after about 2-3 years." The way that functions can compose in the hands of a gifted developer is truly elegant. That said, I'm not sure it's a skill that translates well to the general development communit…

Out of curiosity, what method/resource did you use to try to learn it?

I've tried "Learn You A Haskell for Great Good" and "Real World Haskell".

Re: I tried Haskell for 5 years

#62
post #49
post #8

If anyone's curious to try out functional programming, I would highly recommend Elm. I haven't been so excited about a language since I went from C to Ruby ten years ago, and Pragmatic Studios has a great course on it (I have no affiliation): https://pragmaticstudio.com/courses/elm

Elixir is mentioned on the page too. Does it complement Elm?

Very much so. I'm increasingly seeing more and more projects that use Phoenix (Elixir) on the backend, and Elm on the frontend.

Here's an exciting example: https://github.com/dailydrip/firestorm

Re: I tried Haskell for 5 years

#63
post #24
post #16

Question to the Haskell experts here. Is Haskell more academic in nature or used heavily in Production environments? Is there an application sweet spot/domain (say Artificial Intelligence/Machine Learning, etc) where it shines over using other languages (I am not talking about software/language architectural issues like type systems or such)? I have no experience with Haskell but do use functional languages such as E…

Application sweet spot is a funny thing, because it's mostly determined by the presence of specific libraries. What Haskell has more than anything is ridiculously general libraries. It's got perfectly good libraries for web development, Postgres access &access, but the only place I'd say it's got a real application-specific strength in libraries is parsing. Weirdly, what Haskell is good at is generality. Which is muc…

I agree that parsing libraries are probably the strongest part of the Haskell ecosystem for applications. The only time I've chosen Haskell for a serious application was because of its parsing libraries (specifically parsec): https://blogdown.io/.

Re: I tried Haskell for 5 years

#64
post #12

> very hard to understand why a function could be useful in the first place So true. https://hackage.haskell.org/package/base-4.9.1.0/docs/Contro... > mfix :: (a -> m a) -> m a > The fixed point of a monadic computation. mfix f executes the action f only once, with the eventual output fed back as the input. Hence f should not be strict, for then mfix f would diverge. But why tho?

See: https://wiki.haskell.org/MonadFix

Basically it's the primitive that allows monadic computations to be written in the same lazy cyclic style as regular values in Haskell. (e.g. `ones = 1:ones` to create an infinite lazy list of 1.)

There isn't a single answer to "why?" any more than there is for monads in general, but as an example, I've been looking into using this abstraction to model circuit graphs.

Re: I tried Haskell for 5 years

#65
post #12

> very hard to understand why a function could be useful in the first place So true. https://hackage.haskell.org/package/base-4.9.1.0/docs/Contro... > mfix :: (a -> m a) -> m a > The fixed point of a monadic computation. mfix f executes the action f only once, with the eventual output fed back as the input. Hence f should not be strict, for then mfix f would diverge. But why tho?

It's useful if you want to e.g. traverse a custom tree structure with an effectful function. You can write the function that just does one level of the tree and pass it to mfix to get a version that does the whole tree recursively, composing the effects in the way that naturally makes sense for that kind of effect.

Re: I tried Haskell for 5 years

#66

> 1. There is a learning curve. Time and experience can cover up anything. So this does not say much about Haskell other than it is all negative without time and experience. > 2. Haskell has some very nice libraries So does NodeJS and (on an abstract level) Microsoft Word. Libraries are infrastructures and investments that (like time and experience) can cover up any shortcomings. > 3. Haskell libraries are sometimes…

OP here.

The point about a learning curve is that Haskell is different from most mainstream programming languages.

> > 2. Haskell has some very nice libraries > So does NodeJS and (on an abstract level) Microsoft Word. > Libraries are infrastructures and investments that (like > time and experience) can cover up any shortcomings.

Javascript is one of the most widely used languages in the world and MS Word leverages the Microsoft ecosystem, which is another of the most widely used development environments.

It's when you use less widely used environments (and Haskell may be borderline here) that you need to start worrying about libraries being available. I would not go as far as claiming that Haskell is as good as Javascript in that respect, but it is pretty good.

> > 4. Haskell sometimes feels like C++ > That is also negative, right?

I actually like C++ a lot.

It's also one of the most successful programming languages in the history of programming languages, so it has something going for it.

> > 5. Performance is hard to figure out > That is also negative, right?

Yes, it's a pitfall.

> > 7. Stack changed the game > Another infrastructure investment.

Yes, tooling matters.

Re: I tried Haskell for 5 years

#67
post #16

Question to the Haskell experts here. Is Haskell more academic in nature or used heavily in Production environments? Is there an application sweet spot/domain (say Artificial Intelligence/Machine Learning, etc) where it shines over using other languages (I am not talking about software/language architectural issues like type systems or such)? I have no experience with Haskell but do use functional languages such as E…

Haskell has a preference for looking academic, and is one of the favorites on academic circles. But that does not mean it's not used within industry.

I'd say that people mostly do not know what is running in industry. It could be any share of anything. We get a hint looking at job offers; Haskell is small there, but not unheard of.

On the sweet spot, Haskell is great for modeling complex domains; it's great for long-lived mostly maintenance stuff, since refactoring is so easy; it tends to generate very reliable and reasonably fast (faster than Java/.Net) executables, but hinders complete correctness proofs and has some grave speed issues that can ruin your day if you hit them.

I would like to know how is it to manage a team of Haskell developers. I do expect it to be better than Java/.Net in forcing safe interfaces between developers (thus making it reasonably easy to survive a bad developer in a team), but I never saw it in practice.

Re: I tried Haskell for 5 years

#68
post #48

Earlier quoted context omitted.

We use Haskell in production at lumi.com for our backend/API. We've found it very productive and easy to maintain.

React, HapiJS, RethinkDB, Node and Haskell. That might be the coolest stack ever. Do you have any FOSS project on Github?

No projects under the Lumi name yet, but our team contributes to many FOSS projects and also have their own interesting projects such as Purescript by Phil Freeman who recently joined the team: https://github.com/purescript/purescript

Re: I tried Haskell for 5 years

#69
post #12

> very hard to understand why a function could be useful in the first place So true. https://hackage.haskell.org/package/base-4.9.1.0/docs/Contro... > mfix :: (a -> m a) -> m a > The fixed point of a monadic computation. mfix f executes the action f only once, with the eventual output fed back as the input. Hence f should not be strict, for then mfix f would diverge. But why tho?

Here's a practical application of mfix:

    mfix $ \threadId -> forkIO $ do
      -- computation in forked thread
forkIO creates a new thread and returns its thread id. However, in order to access the returned thread id inside the forked computation, normally one would have to store it in a variable and then read from it inside the thread.

mfix, by nature of its laziness, captures the return value of the function passed to it, and passes it to said function.

Re: I tried Haskell for 5 years

#70
post #28
post #16

Question to the Haskell experts here. Is Haskell more academic in nature or used heavily in Production environments? Is there an application sweet spot/domain (say Artificial Intelligence/Machine Learning, etc) where it shines over using other languages (I am not talking about software/language architectural issues like type systems or such)? I have no experience with Haskell but do use functional languages such as E…

I think I can safely say it isn't used heavily in many production environments but it is used heavily in some. For example, one of Facebook's abuse systems, dealing with 1M requests per second is written in Haskell: https://code.facebook.com/posts/745068642270222/fighting-spa... As for particular places where it shines, I don't know of any in particular. I remember when taking my Declarative Programming course in uni…

If you measure complexity as LOC then Haskell will do well, but you may not end up with uncomplex code :-)
Post reply on HN