Yes, I've added a paragraph about the ST trick there. Another possible use case would be callback functions that receive data from your API:
withHook: (forall a. IsApiData a => a -> IO ()) -> IO ()
This allows withHook to send any data to the callback that implements the IsApiData type class
withHook
IsApiData
I'm confused, isn't this ad-hoc (or 'first-rank' I guess) as it only quantifies over a?
a
No, as you can see the forall is in the parenthesis, the scope does not go until the return type
herp derp, realized it myself just now, ∀x(P(x))->Q ≠ ∀x(P(x)->Q).
∀x(P(x))->Q ≠ ∀x(P(x)->Q)
So this would require an an ad-hoc polymorphic function as argument, yes?
Correct 👍
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yes, I've added a paragraph about the ST trick there. Another possible use case would be callback functions that receive data from your API:
This allows
withHook
to send any data to the callback that implements theIsApiData
type classI'm confused, isn't this ad-hoc (or 'first-rank' I guess) as it only quantifies over
a
?No, as you can see the forall is in the parenthesis, the scope does not go until the return type
herp derp, realized it myself just now,
∀x(P(x))->Q ≠ ∀x(P(x)->Q)
.So this would require an an ad-hoc polymorphic function as argument, yes?
Correct 👍