Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify Ch8 - Monads and Applicatives #186

Open
milesfrain opened this issue Jun 29, 2020 · 0 comments
Open

Clarify Ch8 - Monads and Applicatives #186

milesfrain opened this issue Jun 29, 2020 · 0 comments

Comments

@milesfrain
Copy link
Member

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.

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

No branches or pull requests

1 participant