Question

I have been reading this paper and it is mentioned there that the Applicative class is closed under composition.

What does that actually mean ?

Was it helpful?

Solution

In general, "X is closed under Y" means that if you take some Xs and Y them, the result is an X. For example, "the set of integers is closed under addition" means that if you take two integers and add them, the result is an integer.

Therefore, saying that the class Applicative is closed under composition means that if you take two applicative functors and compose them, the result is also an applicative functor.

OTHER TIPS

The composition of Applicatives f and g is

newtype Compose f g a = Compose { getCompose :: f (g a) }

and "Applicative is closed under composition" means that this newtype itself has an Applicative instance.

http://hackage.haskell.org/package/transformers-0.3.0.0/docs/Data-Functor-Compose.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top