[Haskell-cafe] Proposal: (.:) operator in base.

Conal Elliott conal at conal.net
Tue Aug 23 21:58:54 UTC 2016


Exactly! I'd be disappointed to see (.:) get enshrined in the base when
it's such a special case: just one functor ((->) a), just one class
(Functor), and just two levels deep. Once people learn the general
patterns, they're easy to read & write and *much* more general & flexible.
See http://conal.net/blog/posts/semantic-editor-combinators and the lens
libraries.

-- Conal

On Wed, Aug 17, 2016 at 2:14 PM, Tony Morris <tonymorris at gmail.com> wrote:

> You'd generalise it to:
>
> fmap . fmap :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
>
> And then, would you do the same for Traversable, Foldable and Applicative?
>
> On 18/08/16 03:43, Alex Belanger wrote:
>
> Hi,
>
> Some of you might be familiar with (.:) = (.) . (.).
>
> It has type :: (c -> d) -> (a -> b -> c) -> a -> b -> d
>
> It allows the composition of two functions, the first one, accepting one
> operand, and the second, two operands.
>
> This appears to be a very common pattern, referenced a bit everywhere,
> almost always defined on lambdabot and found in multiple codebases in the
> wild.
>
> I'd like the know the general sentiment about this operator, as well as
> how its inclusion in base, probably Data.Function, would be perceived
> before I actually try to make it happen.
>
> Cheers,
> Alex (nitrix).
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160823/de90ce81/attachment.html>


More information about the Haskell-Cafe mailing list