#4189: Add (<.>) operator (generalizing (.) to Functor)

Conal Elliott conal at conal.net
Fri Aug 6 13:07:48 EDT 2010


In case no one has already mentioned it, (<.>) = fmap.fmap, or more
specifically, result.fmap (where 'result' comes from TypeCompose or
DeepArrow). Usually I prefer this explicit style over ad hoc infix
operators, as the explicit style illustrates and hints toward a more general
situation, made up of compositions of first, second, result, fmap, etc.  See
http://conal.net/blog/posts/semantic-editor-combinators/ .

   - Conal

On Sun, Aug 1, 2010 at 6:52 AM, Maciej Marcin Piechotka <
uzytkownik2 at gmail.com> wrote:

> The proposal is to add (<.>) function to Data.Functor/Control.Applicative:
> (<.>) :: (b -> c) -> (a -> f b) -> a -> f c
> f <.> g = fmap f . g -- (<.>) = (.) . fmap
>
> In intend it is related to <$> in the same way as (.) is related to $:
> (a . b . c) d = a $ b $ c $ d
> (a <.> b <.> c) d = a <$> b <$> c <$> d
>
> a is not specialized to f a to allow such chaining:
> const 1 <.> print <=< (read :: String -> Int) <.> readFile
>  :: (Num t) => FilePath -> IO t
>
> Discussion deadline: 31th August 2010
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20100806/267e93f9/attachment.html


More information about the Libraries mailing list