Generalize name of Parallel typeclass
safareli opened this issue · 3 comments
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
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.
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 ~> mOr 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 ~> mthis wording is not best but gives idea of what i'm thinking on.
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.