Apparently the common name for the ((.).(.)) operator is (.:). Where is (.:) defined? Or do I have to define it myself?
Haskell provides special syntax to support infix notation. An operator is a function that can be applied using infix syntax (Section 3.4), or partially applied using a section (Section 3.5).
The == operator means "is equal". The /= operator means "is not equal". It's supposed to be reminiscent of the mathematical "≠" symbol (i.e., an equals sign with a diagonal line through it).
The Either type is sometimes used to represent a value which is either correct or an error; by convention, the Left constructor is used to hold an error value and the Right constructor is used to hold a correct value (mnemonic: "right" also means "correct").
You can find it in the composition library, along with other higher order function compositions.  This operator is not defined in base.  If you don't want to add a (very small) package as a dependency then just define it yourself, although I would use the more generalize version that uses fmap:
(.:) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
(.:) = fmap fmap fmap
which just fmaps a function through two layers of functors.  For functions, all three of these fmaps specialize to (.).
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