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.
You can think of a lens as just a pointer (like in C). They're not exactly like a pointer...you can't get or modify the address that it points to. But you can get and modify the thing that it points to, which is primarily how you use pointers in C. But lenses can do things that pointers can't do. Namely, they can be composed. If you have a lens that points to a person's birth date dob :: Lens Person Date ...and a len…
How I Start: Haskell
11–20 of 61 posts
Re: How I Start: Haskell
#12Nice article. As of lately, I've been using a bundled GHC app for OSX development. Makes it quite easy to keep (and switch between) multiple Haskell environments. http://ghcformacosx.github.io/
Also, that app is great. Really nice that it comes with Cabal 1.20 .
Re: How I Start: Haskell
#13What 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.
You can think of a lens as just a pointer (like in C). They're not exactly like a pointer...you can't get or modify the address that it points to. But you can get and modify the thing that it points to, which is primarily how you use pointers in C. But lenses can do things that pointers can't do. Namely, they can be composed. If you have a lens that points to a person's birth date dob :: Lens Person Date ...and a len…
Re: How I Start: Haskell
#14Nice article. As of lately, I've been using a bundled GHC app for OSX development. Makes it quite easy to keep (and switch between) multiple Haskell environments. http://ghcformacosx.github.io/
Not sure if you caught this, but that's what Chris Allen is linking to on this page http://new-www.haskell.org/downloads/osx Also, that app is great. Really nice that it comes with Cabal 1.20 .
IIRC, haskell.org used to point to a download of the Haskell Platform for OSX (definitely not to ghc.app at any rate), so when I saw that's where it pointed, I didn't even notice that they'd changed it.
Re: How I Start: Haskell
#15Nice article. As of lately, I've been using a bundled GHC app for OSX development. Makes it quite easy to keep (and switch between) multiple Haskell environments. http://ghcformacosx.github.io/
Not sure if you caught this, but that's what Chris Allen is linking to on this page http://new-www.haskell.org/downloads/osx Also, that app is great. Really nice that it comes with Cabal 1.20 .
Re: How I Start: Haskell
#16I've come to be quite happy with my current VIM setup. I'm using,
* haskellmode for _t and _T (show and insert types, respectively) [0]
* ghc-mod for integration with neco-ghc and syntastic and for running ghc check [1]
* neco-ghc [2]
* neocomplete that uses neco-ghc, for completion suggestions [3]
* syntastic for hlint checking on save [4]
[0] https://github.com/lukerandall/haskellmode-vim
[1] https://github.com/eagletmt/ghcmod-vim
[2] https://github.com/eagletmt/neco-ghc
Re: How I Start: Haskell
#17You know like a TodoMVC ,but in form of tutorial around the same project,a webapp for instance,which would require as little library as possible.
Re: How I Start: Haskell
#18While I was more oriented to former in the past, I have been inclining to latter, lately, for the reason, that what you have built remains more obvious to show and be proud of rather than knowledge of a programming language which might not be practical to build something good for variety of reasons (not soon to say the least).
Re: How I Start: Haskell
#19I like the How I Start serie.On the other hand,while I get that languages have their specificities,I'd like the same project to be implemented in all these languages,to be able to get a quick understanding about how working with these languages feels like. You know like a TodoMVC ,but in form of tutorial around the same project,a webapp for instance,which would require as little library as possible.
Re: How I Start: Haskell
#20Earlier quoted context omitted.
You can think of a lens as just a pointer (like in C). They're not exactly like a pointer...you can't get or modify the address that it points to. But you can get and modify the thing that it points to, which is primarily how you use pointers in C. But lenses can do things that pointers can't do. Namely, they can be composed. If you have a lens that points to a person's birth date dob :: Lens Person Date ...and a len…
Huh? In C, if you have a function from Person* to Date* and another function from Date* to Int*, you can compose them as well, and then use the resulting function to both get and set a person's birth year. The syntax is admittedly ugly, but I don't see any asymmetry between get and set.
Sure, you can do both get and set, but the simple syntax is precisely what we're going for here. Without lenses that set line would have looked like this:
person { dob = (dob person) { year = 2004 } }
And this is just one level of nesting. Adding more levels gets really ugly. Also, lenses make it easy to do this kind of thing in a dynamic and generalized way.