Hacker Timesnew | past | comments | ask | show | jobs | submitlogin
STGi: Visual STG implementation to help understand Haskell's execution model (github.com/quchen)
56 points by adamnemecek on June 25, 2016 | hide | past | favorite | 11 comments


That's what I like about Haskell. Brilliant people writing really cool stuff. I'm constantly amazed by Haskell libraries!


Agreed. I've never felt an "in-over-my-head" feeling as strongly as when I first stumbled upon the Lens package docs on Hackage.


The idea behind lenses is simple, but I haven't used it yet. What's the complexity?


The lens library is more like a dialect of Haskell than a library.


Not trying to sound snarky, serious question: Is it due to Edward's (over)use of the type system, making it fit (however complex) into the Haskell system? Could a more expressive system like Idris have avoided the complexity?

If so, I'm certain there is a simple implementation of the lens idea that's much easier to understand and apply.


No. It's more the sheer breadth and scope of the vocabulary lens develops. It has a ton of operations and abstractions, all written in a distinctly "lensy" style with their own idioms. They fit together beautifully, but are distinct enough from normal Haskell style that learning them takes additional effort.

If you just had a small subset of the library that only exposed, say, Lens, Traversal and Prism, it would be much more approachable—but would also miss out on much of what makes lens so universally useful. It wouldn't hit all the edge cases lens does and it wouldn't be "batteries included". You'd find yourself ultimately reinventing part of the other abstractions that lens has but, since you're doing it independently and ad-hoc, the result would be uglier.


> learning them takes additional effort.

Do you have any recommendations on what might be a good read or project for learning Lens? I played around with it a couple times, but I could never find an introduction or anything that really let me get a grasp on their core concepts and use. I'm not looking so much for the mechanics of how to use them, but more of an overview of when and why I might want to use them.


There's an alternative implementation based on profunctors, discussed here: https://pay.reddit.com/r/haskell/comments/4poiq5/phil_freema...

"lens" can be complex, but it also makes an effort to fit well with the standard Foldable/Traversable/Applicative idioms of Haskell, and it can be seen as an extension of them, both in functionality and in nomenclature.


Thanks for the link and it seems fresh off the press. Is this for Purescript only?

FYI, you can omit "pay." if you added it to get https.


You can implement pure profunctor lenses for Haskell too. I don't know if there's a commonly used library implemented though.


> Is it due to Edward's (over)use of the type system, making it fit (however complex) into the Haskell system?

No, not at all. It fits extremely naturally into Haskell's typesystem. The fit is so natural that it's quite astonishing they weren't discovered earlier.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: