Re: HasCallStack constraint for maximum in Prelude?
X Y via Haskell-Cafe <[email protected]> Mon, 23 Mar 2026 02:38:08 +0100 (CET)
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <[email protected]> |
--===============8492709624200053501== Content-Type: multipart/alternative; boundary="----=_Part_123023_1371428464.1774229888832" ------=_Part_123023_1371428464.1774229888832 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The popularity of this mailing list seems to have declined, alternatives ar= e: * https://www.reddit.com/r/haskell/ * https://discourse.haskell.org/ Regards, =E0=B2=B9=E0=B3=86=E0=B2=82=E0=B2=95=E0=B3=8D-=E0=B2=9C=E0=B2=BE=E0=B2=A8= =E0=B3=8D =E0=B2=B5=E0=B3=8D=E0=B2=AF=E0=B2=BE=E0=B2=A8=E0=B3=8D =E0=B2=9F= =E0=B3=81=E0=B2=AF=E0=B3=8D=E0=B2=B2=E0=B3=8D Henk-Jan van Tuyl =20 > Op 23-03-2026 00:48 CET schreef Todd Wilson via Haskell-Cafe <haskell-caf= [email protected]>: > =20 > =20 > I sent this two months ago but received no response. One of my students a= sked me this, and I didn't know how to answer, so I asked here. Did it slip= in under the radar? Did I ask it in the wrong forum? Or was everyone waiti= ng for someone else to answer? :-) > =20 > Todd Wilson > Department of Computer Science > California State University, Fresno >=20 > On Sat, Jan 24, 2026 at 1:22=E2=80=AFPM Todd Wilson <[email protected]= u mailto:[email protected]> wrote: >=20 > > Should maximum and minimum have HasCallStack constraints like head and = tail do? > > =20 > > ghci> :type head > > head :: GHC.Stack.Types.HasCallStack =3D> [a] -> a > > ghci> head [] > > *** Exception: Prelude.head: empty list > > CallStack (from HasCallStack): > > error, called at libraries/base/GHC/List.hs:1646:3 in base:GHC.List > > errorEmptyList, called at libraries/base/GHC/List.hs:85:11 in base:GH= C.List > > badHead, called at libraries/base/GHC/List.hs:81:28 in base:GHC.List > > head, called at <interactive>:8:1 in interactive:Ghci1 > > ghci> :type maximum > > maximum :: (Foldable t, Ord a) =3D> t a -> a > > ghci> maximum [] > > *** Exception: Prelude.maximum: empty list > > CallStack (from HasCallStack): > > error, called at libraries/base/GHC/List.hs:1646:3 in base:GHC.List > > errorEmptyList, called at libraries/base/GHC/List.hs:717:28 in base:G= HC.List > > maximum, called at libraries/base/Data/Foldable.hs:745:15 in base:Dat= a.Foldable > > =20 > > Todd Wilson > >=20 > _______________________________________________ > Haskell-Cafe mailing list -- [email protected] > To (un)subscribe, modify options or view archives go to: > Only members subscribed via the mailman list are allowed to post. >=20 ------=_Part_123023_1371428464.1774229888832 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <!doctype html> <html> <head>=20 <meta charset=3D"UTF-8">=20 </head> <body> <div>=20 <div class=3D"default-style"> The popularity of this mailing list seems to have declined, alternative= s are: </div>=20 <ul>=20 <li><a href=3D"https://www.reddit.com/r/haskell/">https://www.reddit.co= m/r/haskell/</a></li>=20 <li class=3D"default-style"><a href=3D"https://discourse.haskell.org/">= https://discourse.haskell.org/</a></li>=20 </ul>=20 <div class=3D"io-ox-signature">=20 <div class=3D"default-style"> Regards, </div>=20 <div class=3D"default-style"> =E0=B2=B9=E0=B3=86=E0=B2=82=E0=B2=95=E0=B3=8D-=E0=B2=9C=E0=B2=BE=E0=B2= =A8=E0=B3=8D =E0=B2=B5=E0=B3=8D=E0=B2=AF=E0=B2=BE=E0=B2=A8=E0=B3=8D =E0=B2= =9F=E0=B3=81=E0=B2=AF=E0=B3=8D=E0=B2=B2=E0=B3=8D </div>=20 <div class=3D"default-style"> Henk-Jan van Tuyl </div>=20 </div>=20 </div>=20 <div class=3D"io-ox-signature">=20 <div class=3D"default-style"> </div>=20 </div>=20 <blockquote type=3D"cite">=20 <div> Op 23-03-2026 00:48 CET schreef Todd Wilson via Haskell-Cafe <haskel= [email protected]>: </div>=20 <div> </div>=20 <div> </div>=20 <div dir=3D"ltr">=20 <div dir=3D"ltr"> I sent this two months ago but received no response. One of my student= s asked me this, and I didn't know how to answer, so I asked here. Did it s= lip in under the radar? Did I ask it in the wrong forum? Or was everyone wa= iting for someone else to answer? :-)=20 <div>=20 <div> </div>=20 <div>=20 <div class=3D"gmail_signature" dir=3D"ltr">=20 <div dir=3D"ltr"> Todd Wilson=20 <div> Department of Computer Science </div>=20 <div> California State University, Fresno </div>=20 </div>=20 </div>=20 </div>=20 </div>=20 </div>=20 <br>=20 <div class=3D"gmail_quote gmail_quote_container">=20 <div class=3D"gmail_attr" dir=3D"ltr"> On Sat, Jan 24, 2026 at 1:22=E2=80=AFPM Todd Wilson <<a href=3D"ma= ilto:[email protected]">[email protected]</a>> wrote: </div>=20 <blockquote>=20 <div dir=3D"ltr">=20 <div> Should maximum and minimum have HasCallStack constraints like head = and tail do? </div>=20 <div> </div> ghci> :type head <br>head :: GHC.Stack.Types.HasCallStack =3D> [a] -> a <br>ghci> head [] <br>*** Exception: Prelude.head: empty list <br>CallStack (from HasCallStack): <br> error, called at libraries/base/GHC/List.hs:1646:3 in bas= e:GHC.List <br> errorEmptyList, called at libraries/base/GHC/List.hs:85:1= 1 in base:GHC.List <br> badHead, called at libraries/base/GHC/List.hs:81:28 in ba= se:GHC.List <br> head, called at <interactive>:8:1 in interactive:Gh= ci1 <br>ghci> :type maximum <br>maximum :: (Foldable t, Ord a) =3D> t a -> a <br>ghci> maximum [] <br>*** Exception: Prelude.maximum: empty list <br>CallStack (from HasCallStack): <br> error, called at libraries/base/GHC/List.hs:1646:3 in bas= e:GHC.List <br> errorEmptyList, called at libraries/base/GHC/List.hs:717:= 28 in base:GHC.List <br> maximum, called at libraries/base/Data/Foldable.hs:745:15= in base:Data.Foldable <br>=20 <div> </div>=20 <div> Todd Wilson </div>=20 </div>=20 </blockquote>=20 </div>=20 </div> _______________________________________________ <br>Haskell-Cafe mailing list -- [email protected] <br>To (un)subscribe, modify options or view archives go to: <br>Only members subscribed via the mailman list are allowed to post. </blockquote> </body> </html> ------=_Part_123023_1371428464.1774229888832-- --===============8492709624200053501== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Haskell-Cafe mailing list -- [email protected] To (un)subscribe, modify options or view archives go to: Only members subscribed via the mailman list are allowed to post. --===============8492709624200053501==--