Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Maybe? (Alexander Chen) 2. Re: Maybe? (Imants Cekusins) 3. Re: Maybe? (Alexander Chen) 4. Re: Maybe? (Velichko Lefterov) 5. Re: Maybe? (Imants Cekusins) ---------------------------------------------------------------------- Message: 1 Date: Wed, 13 May 2020 16:01:54 +0200 (CEST) From: Alexander Chen <alexan...@chenjia.nl> To: beginners@haskell.org Subject: [Haskell-beginners] Maybe? Message-ID: <2064015795.90167.1589378514...@ichabod.co-bxl> Content-Type: text/plain; charset="utf-8" Hi, safeHead.hs safeHead :: [a] -> Maybe a safeHead [] = Nothing safeHead (x:_) = Just x prelude> safeHead [23,1,4,2,4,2] Just 23 Question: what am i doing wrong? best, Alexander -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20200513/a754edbb/attachment-0001.html> ------------------------------ Message: 2 Date: Wed, 13 May 2020 17:11:47 +0300 From: Imants Cekusins <ima...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Maybe? Message-ID: <cap1qinb7uvx6kkyym8ar8cb95ojmtp_d6q6l-6e3d+vszn3...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" > > prelude> safeHead [23,1,4,2,4,2] > Just 23 Looks good. What did you expect to see? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20200513/d00170fe/attachment-0001.html> ------------------------------ Message: 3 Date: Wed, 13 May 2020 16:15:22 +0200 (CEST) From: Alexander Chen <alexan...@chenjia.nl> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Maybe? Message-ID: <2080448094.91279.1589379322...@ichabod.co-bxl> Content-Type: text/plain; charset="utf-8" I expected prelude> safeHead [23,1,4,2,4,2] 23 not Just 23 May 13, 2020 4:11:47 PM CEST Imants Cekusins <ima...@gmail.com> wrote: prelude> safeHead [23,1,4,2,4,2] Just 23 Looks good. What did you expect to see? _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20200513/aba51f52/attachment-0001.html> ------------------------------ Message: 4 Date: Wed, 13 May 2020 17:17:38 +0300 From: Velichko Lefterov <velichko.lefte...@gmail.com> To: Alexander Chen <alexan...@chenjia.nl>, The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Maybe? Message-ID: <cajuu68u6pedka7rzsb5iopwpedd9rqfw1tncpnakj3wqvad...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" The function returns Maybe a. On Wed, May 13, 2020 at 5:16 PM Alexander Chen <alexan...@chenjia.nl> wrote: > I expected > > prelude> safeHead [23,1,4,2,4,2] > 23 > > not > Just 23 > > May 13, 2020 4:11:47 PM CEST Imants Cekusins <ima...@gmail.com> wrote: > > prelude> safeHead [23,1,4,2,4,2] > Just 23 > > > Looks good. > > What did you expect to see? > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20200513/881f6bdd/attachment-0001.html> ------------------------------ Message: 5 Date: Wed, 13 May 2020 17:32:08 +0300 From: Imants Cekusins <ima...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Maybe? Message-ID: <cap1qinaqiuxidphtn8s-rn5q+pg1zun15avxnwanugirhey...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Maybe a is a sum type. Show instance for sum types displays the constructor. For example, if we used another sum type: Either Int Int, then Left 23 /= Right 23 So we'd be interested to see the constructor to tell them apart. 23 wouldn't be sufficiently clear. On Wed, May 13, 2020 at 5:18 PM Velichko Lefterov < velichko.lefte...@gmail.com> wrote: > The function returns Maybe a. > > On Wed, May 13, 2020 at 5:16 PM Alexander Chen <alexan...@chenjia.nl> > wrote: > >> I expected >> >> prelude> safeHead [23,1,4,2,4,2] >> 23 >> >> not >> Just 23 >> >> May 13, 2020 4:11:47 PM CEST Imants Cekusins <ima...@gmail.com> wrote: >> >> prelude> safeHead [23,1,4,2,4,2] >> Just 23 >> >> >> Looks good. >> >> What did you expect to see? >> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> >> >> >> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20200513/425f2e09/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 143, Issue 3 *****************************************