Generally, I can get a feel for ‘what sort of a thing’ some type variable is by how it’s used in a type signature.
parTraverse :: forall f m t a b . Parallel f m => Traversable t => (a -> m b) -> t a -> m (t b)
Here I read this as if you give me :
- A function that takes a purescript value, and returns a value in some larger language
- A traversable context containing the same sort of purescript value used by the function
Then I can return you something that relates the two.
I can see that ‘
t’ must meet some constraints because it has an instance of a type class (namely ‘
I’m not sure what to make of ‘
f’ is seen only in the constraints and not the arguments or return type. This reads to me like "It doesn’t matter what ‘
f’ is, just so long as there exists some ‘
f’ somewhere such that ‘
Parallel f m’
Parallel f m’ says about ‘
m’, that must be true of ‘
Given that f doesn’t matter, couldn’t I create a new typeclass ‘
Parallel2’ to read like this:
parTraverse' :: forall m t a b . Parallel2 m => Traversable t => (a -> m b) -> t a -> m (t b)
such that ‘
m’ is now part of a normal constraint? Would I lose anything?