instance Applicative ((->) r) where
This is the implementation of the Applicative typeclass for a function in Haskell. I don't really understand the ((->) r) and how to read it.
I think it means it is a function that takes one parameter and returns anything (another curried function, a String) but I'm not sure, is that right. Would that not be (r ->)
Here, -> is a type-level operator; it takes two types and returns a new type (the function type). In ((->) r, it's partially applied, so you can think of it as a type-level function that takes one type a and returns the type of functions that take an r and returns an a.
((->) r) a == (->) r a -- function application is left-associative
== r -> a -- switch to infix notation
You could say (r ->), except Haskell doesn't support type-level sections. (And I don't think there is a GHC extension to enable such support.)
There isn't really a good way to read it, because it exists at a level of abstraction that isn't talked about commonly enough to merit a natural language description.
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