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

Generalize name of Parallel typeclass #15

Closed
safareli opened this issue Oct 26, 2016 · 3 comments
Closed

Generalize name of Parallel typeclass #15

safareli opened this issue Oct 26, 2016 · 3 comments

Comments

@safareli
Copy link
Contributor

safareli commented Oct 26, 2016

After reading this reddit thread i'm thinking that name Parallel or Concurent is not that precise as this typeclass is just pearing/isomorphism between some Monad and some Applicative.

This are example are not strictly related to concurrency/parallelism:

  • List Monad and ZipList Applicative
  • Either Monad and Validation Applicative

For now I don't have a better name but will think on this.

Related fantasy-land#186

@garyb
Copy link
Member

garyb commented Oct 26, 2016

It's true it is more widely applicable, but Parallel is the intent for it since it's attempting to capture Monad/Applicative relationships where the behaviour of the Applicative differs from that of the Monad so as to enable parallelism.

As an example, see here:

purescript/purescript-transformers#77 (comment)

(The issue is now fixed, but if you use parallel with MaybeT or EitherT it behaves as in the example there, where the effects occur regardless of failure).

Soo, I'm not sure what to suggest. There almost certainly is a more accurate description for what this class represents, but only if you ignore the operational semantics.

@safareli
Copy link
Contributor Author

Yes but going from Either to Validation using parallel sounds weird, but going from Validation to Either using sequential lgtm as "sequential" captures behavior of Monads in general.

If we have some word which captures behavior of Applicatives for example "static".
Difference between Monad and Applicative is that with applicative we have whole computation statically available but Monads are more powerful and program written using Monads can not be observed statically i.e. is dynamic so if we somehow express that, then we would have much general name/words for the typeclass:

class (Monad m, Applicative f) <= _______ f m | m -> f, f -> m where
  static  :: m ~> f
  dynamic :: f ~> m

Or maybe if we look at monad and applicative as strong and weak then:

class (Monad m, Applicative f) <= Strength f m | m -> f, f -> m where
  weaken     :: m ~> f
  strengthen :: f ~> m

this wording is not best but gives idea of what i'm thinking on.

@hdgarrood
Copy link

I think "parallel" and "sequential" make sense; as you say, "sequential" is kind of intrinsic to monads, and "parallel" is the natural opposite of "sequential". In any case, neither static/dynamic nor weaken/strengthen seem to have generated much interest, and this issue has been open for a very long time, so I vote to close.

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

No branches or pull requests

3 participants