Bob Glamm
07/16/2019, 3:32 AMEither l r :: * -> * -> *
is implemented via Kind<F, A>
in Arrowsimon.vergauwen
07/16/2019, 6:20 AMKind<Kind<F, A>, B
or Kind2<F, A, B>
.simon.vergauwen
07/16/2019, 6:25 AMKind
as the way to apply a type argument to a type constructor.
If we say that List
is a type constructor that takes 1 type argument (*-> *) then it can be made into a type using a single type application Kind<ForList, A>
(= List<A>).
For a map, which takes 2 type arguments we need to apply it twice. Which means we can also "curry" it into a type which only needs 1 type argument, for example we could already apply the type argument of the keys. Kind<ForMap, String>
and now this type fits all maps that have Map<String,?>
.
Which is the same shape as List
(* -> *), and you can use it in the same way with typeclasses such as Functor
or Traverse
.simon.vergauwen
07/16/2019, 6:26 AMKind<F, A>
is the same as F<A>
, we can eliminate fix
from the code. We can do so with compiler plugins.