> Applicative functors have been lurking in the background throughout this book. For example, the Region struct defined above is also an applicative functor:
func pure<A>(value: A) -> Region<A> {
return Region { pos in value }
}
func <*><A,B>(regionF: Region<A -> B>,
regionX: Region<A>) -> Region<B> {
return Region { pos in regionF.value(pos)(regionX.value(pos)) }
}
Can you explain more about this Region { pos in regionF.value(pos)(regionX.value(pos)) } ? What is the value inside regionF? Can you give an example?
I'm reading chapter
Functor, Applicative Functor and Monads
, sectionApplicative Functor
There is an example about
Region
Can you explain more about this
Region { pos in regionF.value(pos)(regionX.value(pos)) }
? What is thevalue
insideregionF
? Can you give an example?