-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Syntactically nice commutative applicative functors are a requirement. To be specific by what I mean, I mean applicative functors which satisfy the following equation:
liftA2 f fa fb = liftA2 (flip f) fb faSo think Maybe, Reader, and Behavior, but not List or IO. Haskell's do-notation currently requires an order be specified syntactically which absolutely sucks. In TypeScript this can be done with a function like so:
declare function maybeDo<T>(recipe: (getter: <U>(m: Maybe<U>) => U) => T): Maybe<T>;It isn't type safe, but is much more pleasant to write and read as there is no arbitrary apply-order to get in the way. I do not know how this could be done without special syntax.
Metadata
Metadata
Assignees
Labels
No labels