Re: Add Data.Sequence.toList
Rick Owens <[email protected]> Sun, 8 Mar 2026 10:10:47 -0500
| Newsgroups | gmane.comp.lang.haskell.libraries |
|---|---|
| Message-ID | <CABswET2KOPmn9O=k163+-EtRJRrgL6o_0kT--YNpUqMdv41REA@mail.gmail.com> |
--===============4653060022003855987== Content-Type: multipart/alternative; boundary="000000000000987294064c84b1fd" --000000000000987294064c84b1fd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I support this change largely for the motivations originally described <https://github.com/haskell/containers/issues/744#issuecomment-689484639>, particularly predictability and safety. I can't immediately think of a way this addition would be a liability. -Rick On Sat, Mar 7, 2026 at 9:01=E2=80=AFPM chessai <[email protected]> wrot= e: > I second this addition. Though I will note that there are potential > performance improvements to be had for a monomorphic version due to > specialisation and inlining - I typically prefer mononorphic toList when > available. This and API uniformity are sufficient motivations to me (even > just API uniformity alone). > > Brandon, the libraries mailing list is archaic and mostly used now to > request package takeovers or for CLC elections. Back in 2020 it was still > used. I don't think posting here is necessary anymore (and it was almost > never productive). > > Cheers, > chessai > > On Sat, Mar 7, 2026, 3:56=E2=80=AFPM Brandon Chinn <brandonchinn178@gmail= .com> > wrote: > >> My concern here isn't efficiency. Data.Sequence.toList should just be a >> reexport of Foldable.toList monomorphized to Seq. I just want a consiste= nt >> API with other modules in containers. >> >> I do see that Map.toList /=3D Foldable.toList. But Set.toList =3D=3D >> Foldable.toList, and it's not obvious to me why Set should have toList a= nd >> not Seq. >> >> On Sat, Mar 7, 2026, 3:37=E2=80=AFPM Dan Dart <[email protected]= > wrote: >> >>> Well, it's got a Foldable instance already, which gives you a toList fo= r >>> anything Foldable, is it going to get any more efficientlythan this one= ? >>> That's one of the few reasons to add extra functions already covered by >>> type class instances, no? >>> >>> Cheers >>> >>> On Sat, 7 Mar 2026, 23:20 , <[email protected]> wrote: >>> >>>> An issue was opened on containers back in 2020 to add a monomorphic >>>> Data.Sequence.toList function: >>>> https://github.com/haskell/containers/issues/744. It was suggested to >>>> ask via the libraries list, and the previous reporter preferred to clo= se >>>> the issue instead of continuing the process. I'm opening it back up: >>>> https://github.com/haskell/containers/issues/1184. Same motivation as >>>> the original issue; specifically, I always workaround this with >>>> >>>> import Data.Foldable qualified as Seq (toList) >>>> import Data.Sequence (Seq) >>>> import Data.Sequence qualified as Seq >>>> >>>> It's odd that Data.Sequence doesn't provide toList when Map and Set do= . >>>> Are there any objections to this? >>>> >>>> Best, >>>> Brandon Chinn >>>> _______________________________________________ >>>> Libraries mailing list -- [email protected] >>>> To unsubscribe send an email to [email protected] >>>> >>> _______________________________________________ >> Libraries mailing list -- [email protected] >> To unsubscribe send an email to [email protected] >> > _______________________________________________ > Libraries mailing list -- [email protected] > To unsubscribe send an email to [email protected] > --000000000000987294064c84b1fd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>I support this change largely for the <a href=3D"http= s://github.com/haskell/containers/issues/744#issuecomment-689484639">motiva= tions originally described</a>, particularly predictability and safety.</di= v><div><br></div><div>I can't immediately think of a way this addition = would be a liability.<br><br></div><div>-Rick</div></div><br><div class=3D"= gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On= Sat, Mar 7, 2026 at 9:01=E2=80=AFPM chessai <<a href=3D"mailto:chessai1= [email protected]">[email protected]</a>> wrote:<br></div><blockquote cl= ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid= rgb(204,204,204);padding-left:1ex"><div dir=3D"auto"><div>I second this ad= dition. Though I will note that there are potential performance improvement= s to be had for a monomorphic version due to specialisation and inlining - = I typically prefer mononorphic toList when available. This and API uniformi= ty are sufficient motivations to me (even just API uniformity alone).</div>= <div dir=3D"auto"><br></div><div dir=3D"auto">Brandon, the libraries mailin= g list is archaic and mostly used now to request package takeovers or for C= LC elections. Back in 2020 it was still used. I don't think posting her= e is necessary anymore (and it was almost never productive).</div><div dir= =3D"auto"><br></div><div dir=3D"auto">Cheers,</div><div dir=3D"auto">chessa= i<br><br><div class=3D"gmail_quote" dir=3D"auto"><div dir=3D"ltr" class=3D"= gmail_attr">On Sat, Mar 7, 2026, 3:56=E2=80=AFPM Brandon Chinn <<a href= =3D"mailto:[email protected]" rel=3D"noreferrer" target=3D"_blank">= [email protected]</a>> wrote:<br></div><blockquote class=3D"gmai= l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20= 4,204);padding-left:1ex"><div dir=3D"auto">My concern here isn't effici= ency. Data.Sequence.toList should just be a reexport of Foldable.toList mon= omorphized to Seq. I just want a consistent API with other modules in conta= iners.<div dir=3D"auto"><br></div><div dir=3D"auto">I do see that Map.toLis= t /=3D Foldable.toList. But Set.toList =3D=3D Foldable.toList, and it's= not obvious to me why Set should have toList and not Seq.</div></div><br><= div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Mar= 7, 2026, 3:37=E2=80=AFPM Dan Dart <<a href=3D"mailto:haskellcafe@dandar= t.co.uk" rel=3D"noreferrer noreferrer" target=3D"_blank">haskellcafe@dandar= t.co.uk</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"= margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef= t:1ex"><div dir=3D"auto"><div>Well, it's got a Foldable instance alread= y, which gives you a toList for anything Foldable, is it going to get any m= ore efficientlythan this one? That's one of the few reasons to add extr= a functions already covered by type class instances, no?</div><div><br></di= v><div dir=3D"auto">Cheers</div></div><br><div class=3D"gmail_quote"><div d= ir=3D"ltr" class=3D"gmail_attr">On Sat, 7 Mar 2026, 23:20 , <<a href=3D"= mailto:[email protected]" rel=3D"noreferrer noreferrer noreferrer" = target=3D"_blank">[email protected]</a>> wrote:<br></div><blockq= uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p= x solid rgb(204,204,204);padding-left:1ex">An issue was opened on container= s back in 2020 to add a monomorphic Data.Sequence.toList function: <a href= =3D"https://github.com/haskell/containers/issues/744" rel=3D"noreferrer nor= eferrer noreferrer noreferrer noreferrer" target=3D"_blank">https://github.= com/haskell/containers/issues/744</a>. It was suggested to ask via the libr= aries list, and the previous reporter preferred to close the issue instead = of continuing the process. I'm opening it back up: <a href=3D"https://g= ithub.com/haskell/containers/issues/1184" rel=3D"noreferrer noreferrer nore= ferrer noreferrer noreferrer" target=3D"_blank">https://github.com/haskell/= containers/issues/1184</a>. Same motivation as the original issue; specific= ally, I always workaround this with<br> <br> =C2=A0 =C2=A0 import Data.Foldable qualified as Seq (toList)<br> =C2=A0 =C2=A0 import Data.Sequence (Seq)<br> =C2=A0 =C2=A0 import Data.Sequence qualified as Seq<br> <br> It's odd that Data.Sequence doesn't provide toList when Map and Set= do. Are there any objections to this?<br> <br> Best,<br> Brandon Chinn<br> _______________________________________________<br> Libraries mailing list -- <a href=3D"mailto:[email protected]" rel=3D"n= oreferrer noreferrer noreferrer noreferrer" target=3D"_blank">libraries@has= kell.org</a><br> To unsubscribe send an email to <a href=3D"mailto:[email protected]= rg" rel=3D"noreferrer noreferrer noreferrer noreferrer" target=3D"_blank">l= [email protected]</a><br> </blockquote></div> </blockquote></div> _______________________________________________<br> Libraries mailing list -- <a href=3D"mailto:[email protected]" rel=3D"n= oreferrer noreferrer" target=3D"_blank">[email protected]</a><br> To unsubscribe send an email to <a href=3D"mailto:[email protected]= rg" rel=3D"noreferrer noreferrer" target=3D"_blank">libraries-leave@haskell= .org</a><br> </blockquote></div></div></div> _______________________________________________<br> Libraries mailing list -- <a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a><br> To unsubscribe send an email to <a href=3D"mailto:[email protected]= rg" target=3D"_blank">[email protected]</a><br> </blockquote></div> --000000000000987294064c84b1fd-- --===============4653060022003855987== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Libraries mailing list -- [email protected] To unsubscribe send an email to [email protected] --===============4653060022003855987==--