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…
How I Start: Haskell
31–40 of 61 posts
Re: How I Start: Haskell
#32Very 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.
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
#33Re: How I Start: Haskell
#34For 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…
Re: How I Start: Haskell
#35What 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…
Was lens-family one of the simpler ones?
https://hackage.haskell.org/package/lens-familyRe: How I Start: Haskell
#36For 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...
He can be found at https://twitter.com/cartazio and in the #numerical-haskell Freenode IRC channel.
Re: How I Start: Haskell
#37For 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...
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
#38Earlier 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
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
#39Earlier 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.
Re: How I Start: Haskell
#40Very 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.