I've found the following class instance : (Monad m, (~) * a ()) => LaTeXC (LaTeXT m a)
, but can't quite understand its context.
What does (~) * a ()
mean? Where can I read about it?
(~)
is type-level equality (you could write it as some variant of =
or ==
, but the opinion was that this notation already had enough different meanings that introducing another would be confusing). *
is the kind of types. So (~) *
is the assertion that two (inhabitable) types are equal. In other words, the instance could also be written like this:
instance Monad m => LaTeXC (LaTeXT m ())
Why wasn't it? Well, it's a question of inference. The way it was written makes the compiler choose this instance even if it doesn't (yet) know that the final argument to LaTeXT
is ()
, then forces that, whereas the proposed alternative instance would simply complain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With