Live data from Hacker News

How I Start: Haskell

howistart.org

31–40 of 61 posts

Re: How I Start: Haskell

#31
post #9
post #2

What do you think about the lens library? I have been trying Haskell for a few weeks and this library feels strange. Also I don't really think I need the things it provides. But perhaps I just don't understand it.

Lens is difficult to get your head around. It is simultaneously a rather simple idea ("bundle getters and setters together... ") and a ridiculously sophisticated and generalized implementation ("... in every conceivable lawful way such that they all work together as they ought to!"). You probably do want lenses. Learning to use them is its own "mind blowing" experience similar to learning functional programming itsel…

Thank you.

Re: How I Start: Haskell

#32
post #21

Very interesting! Is there something like this for other languages / frameworks? I'd love to see something like this for Ruby + Sintara + MySQL/PostgerSQL for writing a RESTful API setup.

Hi, author here!

It's intentionally tiny, so a bit trivial, but here's a URL shortener in Scotty. Scotty is a library that gives you a toolkit for making webapps in a manner similar to Sinatra.

http://bitemyapp.com/posts/2014-08-22-url-shortener-in-haske...

Re: How I Start: Haskell

#34

For more practical examples like this, I highly recommend the Haskell Data Analysis Cookbook [1]. After learning the basics of Haskell, having a book chock full of practical examples of things like handling CVS files, JSON, trees, graphs, machine learning, and Haskell's outstanding support for parallel computation--is a really helpful resource. The code is extremely well written; clear, concise, and readable. The aut…

Yes, I found the Data Analysis cookbook very helpful as well. However, it really drove home to me the need for a dataframe/Pandas-like library in Haskell... About half the code in every one of his examples was reading a CSV file, parsing it into some ad-hoc data structure etc. For very robust production apps, that can be justifiable, but for just a quick look at some data, it should just be a one-liner...

Re: How I Start: Haskell

#35
post #9
post #2

What do you think about the lens library? I have been trying Haskell for a few weeks and this library feels strange. Also I don't really think I need the things it provides. But perhaps I just don't understand it.

Lens is difficult to get your head around. It is simultaneously a rather simple idea ("bundle getters and setters together... ") and a ridiculously sophisticated and generalized implementation ("... in every conceivable lawful way such that they all work together as they ought to!"). You probably do want lenses. Learning to use them is its own "mind blowing" experience similar to learning functional programming itsel…

There's also simpler packages, right? Targeted at having less power, but being more understandable as a result.

Was lens-family one of the simpler ones?

    https://hackage.haskell.org/package/lens-family

Re: How I Start: Haskell

#36

For more practical examples like this, I highly recommend the Haskell Data Analysis Cookbook [1]. After learning the basics of Haskell, having a book chock full of practical examples of things like handling CVS files, JSON, trees, graphs, machine learning, and Haskell's outstanding support for parallel computation--is a really helpful resource. The code is extremely well written; clear, concise, and readable. The aut…

Yes, I found the Data Analysis cookbook very helpful as well. However, it really drove home to me the need for a dataframe/Pandas-like library in Haskell... About half the code in every one of his examples was reading a CSV file, parsing it into some ad-hoc data structure etc. For very robust production apps, that can be justifiable, but for just a quick look at some data, it should just be a one-liner...

Carter is working on a numerical stack for Haskell that should make writing a pandas-esque library in Haskell pretty easy.

He can be found at https://twitter.com/cartazio and in the #numerical-haskell Freenode IRC channel.

Re: How I Start: Haskell

#37

For more practical examples like this, I highly recommend the Haskell Data Analysis Cookbook [1]. After learning the basics of Haskell, having a book chock full of practical examples of things like handling CVS files, JSON, trees, graphs, machine learning, and Haskell's outstanding support for parallel computation--is a really helpful resource. The code is extremely well written; clear, concise, and readable. The aut…

Yes, I found the Data Analysis cookbook very helpful as well. However, it really drove home to me the need for a dataframe/Pandas-like library in Haskell... About half the code in every one of his examples was reading a CSV file, parsing it into some ad-hoc data structure etc. For very robust production apps, that can be justifiable, but for just a quick look at some data, it should just be a one-liner...

This rings very true to my use as well. I'd like to see something like Vinyl specialized to data frames, but nobody has built it yet.

Edit: see the post by coolsunglasses below—Carter's work is certainly the furthest along in this direction that I'm aware of.

Re: How I Start: Haskell

#38
post #35
post #9

Earlier quoted context omitted.

Lens is difficult to get your head around. It is simultaneously a rather simple idea ("bundle getters and setters together... ") and a ridiculously sophisticated and generalized implementation ("... in every conceivable lawful way such that they all work together as they ought to!"). You probably do want lenses. Learning to use them is its own "mind blowing" experience similar to learning functional programming itsel…

There's also simpler packages, right? Targeted at having less power, but being more understandable as a result. Was lens-family one of the simpler ones? https://hackage.haskell.org/package/lens-family

There are a lot of lens packages. I'd roughly split them into the "Van Laarhoven style" and the "Abstract style".

In the Abstract Style there is `data-lens` and `fclabels`. These use some kind of packaged form of (getter,setter) and require a Category instance to compose using (.). They are all mutually incompatible with one another.

In the Van Laarhoven Style are `lens`, `lens-family`, and `lens-family-core` of which the last is the simplest. These are all mutually compatible, and compose automatically using regular function composition and the Prelude version of (.), but they're somewhat hairy to see at first since they must expose their underlying type (for subtyping purposes) and that one is pretty unexpectedly weird.

I recommend using Van Laarhoven style lenses. If you really want an abstract style lens, fclabels is the best I've been told.

Re: How I Start: Haskell

#39

Earlier quoted context omitted.

Yes, I found the Data Analysis cookbook very helpful as well. However, it really drove home to me the need for a dataframe/Pandas-like library in Haskell... About half the code in every one of his examples was reading a CSV file, parsing it into some ad-hoc data structure etc. For very robust production apps, that can be justifiable, but for just a quick look at some data, it should just be a one-liner...

Carter is working on a numerical stack for Haskell that should make writing a pandas-esque library in Haskell pretty easy. He can be found at https://twitter.com/cartazio and in the #numerical-haskell Freenode IRC channel.

https://github.com/sdiehl/frame and https://github.com/ekmett/tables came up in IRC as well.

Re: How I Start: Haskell

#40
post #21

Very interesting! Is there something like this for other languages / frameworks? I'd love to see something like this for Ruby + Sintara + MySQL/PostgerSQL for writing a RESTful API setup.

Sorry if this isn't what you're asking, but this article is part of a series for different languages: http://howistart.org/
Post reply on HN