Generalizing some type signatures involving Int

David Feuer david.feuer at gmail.com
Wed Nov 14 03:25:41 UTC 2018


You still haven't said why you need this. Only a rather exotic data
structure is likely to have a length greater than maxBound @Int.

On Tue, Nov 13, 2018, 10:23 PM Vanessa McHale <vanessa.mchale at iohk.io wrote:

> I want more than this, actually. genericLength doesn't work over any
> Foldable.
>
> On 11/13/18 8:50 PM, Evan Laforge wrote:
> > You can already get these as Data.List.genericLength and
> > Data.List.genericReplicate
> >
> > As for changing the prelude ones, this would probably cause a lot of
> > busywork.  Where I work we compile with -Werror and -Wtype-defaults,
> > so a lot of places might have to get type annotations.
> > On Tue, Nov 13, 2018 at 5:19 PM Vanessa McHale <vanessa.mchale at iohk.io>
> wrote:
> >> 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
> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20181113/5d2acde4/attachment.html>


More information about the Libraries mailing list