Re: Add Data.Sequence.toList

Brandon Chinn <[email protected]> Sat, 7 Mar 2026 15:56:13 -0800
Newsgroups gmane.comp.lang.haskell.libraries
Message-ID <CAGANf=e8zqEuYf19FPHU_6vGha9Q_=Ondn7aNBVwqd=56NbYcg@mail.gmail.com>
--===============4398607564034702910==
Content-Type: multipart/alternative; boundary="000000000000b0db70064c77ea45"

--000000000000b0db70064c77ea45
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

My concern here isn't efficiency. Data.Sequence.toList should just be a
reexport of Foldable.toList monomorphized to Seq. I just want a consistent
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 and
not Seq.

On Sat, Mar 7, 2026, 3:37=E2=80=AFPM Dan Dart <[email protected]> w=
rote:

> Well, it's got a Foldable instance already, which gives you a toList for
> anything Foldable, is it going to get any more efficient than 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 close
>> 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]
>>
>

--000000000000b0db70064c77ea45
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">My concern here isn&#39;t efficiency. Data.Sequence.toLis=
t should just be a reexport of Foldable.toList monomorphized to Seq. I just=
 want a consistent API with other modules in containers.<div dir=3D"auto"><=
br></div><div dir=3D"auto">I do see that Map.toList /=3D Foldable.toList. B=
ut Set.toList =3D=3D Foldable.toList, and it&#39;s not obvious to me why Se=
t should have toList and not Seq.</div></div><br><div class=3D"gmail_quote =
gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Mar 7,=
 2026, 3:37=E2=80=AFPM Dan Dart &lt;<a href=3D"mailto:[email protected]=
o.uk">[email protected]</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"auto"><div>Well, it&#39;s got a Foldable instance=
 already, which gives you a toList for anything Foldable, is it going to ge=
t any more efficient than this one? That&#39;s one of the few reasons to ad=
d extra functions already covered by type class instances, no?</div><div><b=
r></div><div dir=3D"auto">Cheers</div></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Sat, 7 Mar 2026, 23:20 , &lt;<a hr=
ef=3D"mailto:[email protected]" target=3D"_blank" rel=3D"noreferrer=
">[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex">An issue was opened on containers back in 2020 to add a monomorphic=
 Data.Sequence.toList function: <a href=3D"https://github.com/haskell/conta=
iners/issues/744" rel=3D"noreferrer noreferrer noreferrer" target=3D"_blank=
">https://github.com/haskell/containers/issues/744</a>. It was suggested to=
 ask via the libraries list, and the previous reporter preferred to close t=
he issue instead of continuing the process. I&#39;m opening it back up: <a =
href=3D"https://github.com/haskell/containers/issues/1184" rel=3D"noreferre=
r noreferrer noreferrer" target=3D"_blank">https://github.com/haskell/conta=
iners/issues/1184</a>. Same motivation as the original issue; specifically,=
 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&#39;s odd that Data.Sequence doesn&#39;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" 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>
</blockquote></div>

--000000000000b0db70064c77ea45--

--===============4398607564034702910==
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]

--===============4398607564034702910==--