Where is `EitherT`'s Applicative instance defined?

Viewed 66

I don't see it here by the definition of EitherT, nor here by the definition of Applicative.

Shouldn't it be defined within the type module or within the typeclass module, to avoid being orphaned? Where is it?

2 Answers

The docs page you linked for EitherT clearly shows that EitherT is a type alias:

type EitherT = ExceptT

Type alias for ExceptT

That means it cannot have its own instances; any instances it has will be defined for the type it is an alias for; in this case ExceptT.

Conveniently, it also links to the docs for ExceptT. Inconveniently, it links those two occurrences of ExceptT to different URLs! One of them seems to be a broken link (to a module that exists in mtl, as if it existed in the transformers-either package), but the other one works, and shows:

(Functor m, Monad m) => Applicative (ExceptT e m)
Related