Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Can`t realize ap composition #46

@Ne4to777

Description

@Ne4to777

Fantasy Land spec:
v.ap(u.ap(a.map(f => g => x => f(g(x))))) is equivalent to v.ap(u).ap(a) (composition)

Implementation:

const v = Task.of(f => g => x => f(g(x)))
const u = Task.of(x => x * 3)
const a = Task.of(x => x + 3)

v
.ap(u
.ap(a
.map(f => g => x => f(g(x)))))
.fork(console.error, console.log)

Log: g => x => f(g(x))

v
.ap(u)
.ap(a)
.fork(console.error, console.log)

Log: x => f(g(x))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions