Skip to content

Commutative applicative functors #10

@probeiuscorp

Description

@probeiuscorp

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 fa

So 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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions