Generalizing some type signatures involving Int

Vanessa McHale vanessa.mchale at iohk.io
Wed Nov 14 03:19:33 UTC 2018


I certainly do! What's wrong with iterating over a Word?

On 11/13/18 8:49 PM, Eric Mertens wrote:
> Int is the right type to be able to do efficient internal operations
> when implementing length and replicate. It's unlikely that someone
> would want to run these operations on another type internally than
> Int. Some times people propose types like these where they imagine
> just a built-in use of fromIntegral on either the initial argument or
> the result, but that really quite unnecessary. Could you elaborate on
> what cases you had in mind?
>
> While genericLength exists, I have yet to see a good use of it.
>
> Best regards,
> Eric Mertens
> glguy
>
> On Tue, Nov 13, 2018 at 5:34 PM Alexandre Rodrigues
> <alexandreR_B at outlook.com <mailto:alexandreR_B at outlook.com>> wrote:
>
>     :+1: from me.
>
>      
>
>     ------------------------------------------------------------------------
>     *From:* Libraries <libraries-bounces at haskell.org
>     <mailto:libraries-bounces at haskell.org>> on behalf of Vanessa
>     McHale <vanessa.mchale at iohk.io <mailto:vanessa.mchale at iohk.io>>
>     *Sent:* Wednesday, November 14, 2018 1:18:58 AM
>     *To:* Haskell Libraries
>     *Subject:* Generalizing some type signatures involving Int
>      
>     Would it be possible to generalize replicate and length to have type
>     signatures
>
>     replicate :: Integral a => a -> b -> [b]
>
>     and
>
>     length :: (Integral a, Foldable t) => t b -> a
>
>     ?
>
>     There have been a few instances where such a thing would have been
>     useful to me.
>
>     Cheers
>
>
>     _______________________________________________
>     Libraries mailing list
>     Libraries at haskell.org <mailto:Libraries at haskell.org>
>     http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
>
> -- 
> Eric Mertens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20181113/bcfaca8a/attachment.html>
-------------- 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/20181113/bcfaca8a/attachment.sig>


More information about the Libraries mailing list