Reputation: 5594
I'm reading A Little Lens Starter Tutorial and they use a seemingly magical function forall
like this:
>>> forall $ \tuple -> view _1 tuple == fst tuple
True
What exactly does this function do and more importantly what package is it from. I can't find it using Hoogle, etc.
Upvotes: 6
Views: 222
Reputation: 74364
Haha, embarrassed author here.
I invented forall
to mime quickCheck
and make intuitive sense, but not to be executable. In my defense, I took inspiration from the Little Schemer which happily introduces syntax and semantics far before they're executable in order to build intuition by practice.
Except, of course, my forall
is not actually executable at all and it has lead to a lot of confusion.
So, my suggestion to anyone curious is to investigate quickcheck
as a stand-in for forall
. My suggestion to myself, now carried out, is to edit the tutorial to note my artistic license there.
Sorry about any trouble.
Upvotes: 5
Reputation: 3081
That's not actually executable code. See this answer: https://twitter.com/vh4x0r/status/429256064245067777
Upvotes: 4