Adding dup to Data.Tuple?

Vanessa McHale vanessa.mchale at iohk.io
Sun Oct 28 13:48:42 UTC 2018


According to GHCi,

λ:> import Control.Arrow
λ:> :t (id &&& id) (id &&& id) :: b -> (b, b)

That is, this implementation has type a -> (a, a) as well.

On 10/28/18 6:52 AM, Ivan Perez wrote:
>
> On 28/10/18 03:51, Dannyu NDos wrote:
>> If this is for convenience for arrows, isn't it better implemented as?:
>>
>> dup :: Arrow a => a b (b,b)
>> dup = id &&& id
>
> Hi
>
> Performance aside, I'd say your suggestion is better than using a pure
> function. It's clearer about what it does, and it works for functions
> as well (since they are arrows).
>
> Ivan
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20181028/307bf3c2/attachment.sig>


More information about the Libraries mailing list