News for hackers. Stuff that matters.
Re:Dhall: A Gateway Drug to Haskell by spion on Tuesday June 07, 2022 @09:15PM (#31662103)
Oh the overview page is even worse for readability

  _1 :: Lens' (a,b) a
is used immediately after

  set :: Lens' a b -> b -> a -> a
which completely messes with anyone who's mind works in a way that makes it extremely difficult when symbols are immediately reused with completely different meanings.

To summarize, Haskell documentation communication is biased against linguistically clear explanations and towards mathematically precise, symbolic "explanation", and those who are used to unnecessarily struggling with the latter style due to their math background are more likely to "make it".

Re:Dhall: A Gateway Drug to Haskell by Karrot_Kream on Tuesday June 07, 2022 @09:32PM (#31662236)
The Lens library sucks even if you're fluent in advanced math and Haskell. In practice when I have to use Lens (usually with JSON), I just code golf it until it works because it's so damn impenetrable.
Re:Dhall: A Gateway Drug to Haskell by axman6 on Sunday June 19, 2022 @11:54AM (#31800489)
I couldn’t agree with this opinion less - lens is incredibly elegant, and very consistent. It is a DSL, and you need to spend some time learning the domain, but once you do you’ll find it hard to live without it. If that’s the way you use the library then you haven’t spent any time to learn how to use it.
Re:Dhall: A Gateway Drug to Haskell by solomonb on Wednesday June 08, 2022 @12:01AM (#31663039)
If you apply `_1` to `set` then it specializes to `set _1 :: a -> (a, b) -> (a, b)`.

Yes its confusing. It sometimes helps to give longer variables:

    _1 :: Lens' (fst, snd) fst
    set :: Lens' structure focus -> focus -> structure -> structure

    set _1 :: fst -> (fst, snd) -> (fst, snd)

You are bumping up against the severe amount of polymorphism at play in the lens library. This makes it hard to build a mental model but is a tremendous source of expressiveness and utility.