Where is the Haskell operator (. :) defined?

Apparently, the common name of the operator is ((.).(.)) (.:) . Where indicated (.:) ? Or should I determine this myself?

+5
source share
1 answer

You can find it in the composition library along with other compositions of higher order functions. This statement is not defined in base . If you don't want to add a (very small) package as a dependency, just define it yourself, although I would use a more generalized version that uses fmap :

 (.:) :: (Functor f, Functor g) => (a -> b) -> f (ga) -> f (gb) (.:) = fmap fmap fmap 

which just fmap performs the function through two layers of functors. For functions, all three of these fmap specialize in (.) .

+8
source

Source: https://habr.com/ru/post/1216323/


All Articles