Skip to content

Clarify Ch8 - Monads and Applicatives #186

Description

@milesfrain

This section could be made more beginner-friendly:
https://book.purescript.org/chapter8.html#monads-and-applicatives

Inspired by #184

Improvement ideas:

1. A concrete example of using ap for an Apply instance.

Replace F with another type

instance applyF :: Apply F where
  apply = ap

https://pursuit.purescript.org/packages/purescript-prelude/4.1.1/docs/Control.Monad#v:ap

2. Note that even though Monad depends on Apply, the implementation of apply can depend on Monad. This flexibility may be unexpected by readers.

3. Change

Try writing userCity using only pure and apply

to

Try writing userCity using only what's available from Applicative (map, apply, pure) and without the additional Bind capabilities of Monad. This means no using bind or <- in do notation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions