Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/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. Re: Good style on "." and "$" pipeline? (Chadda? Fouch?) 2. Re: The Holy Trinity of Functional Programming (Christopher Howard) 3. Re: The Holy Trinity of Functional Programming (Costello, Roger L.) 4. Re: The Holy Trinity of Functional Programming (Brandon Allbery) 5. Re: Good style on "." and "$" pipeline? (Brandon Allbery) 6. Re: The Holy Trinity of Functional Programming (Edward Z. Yang) 7. [Real World Haskell] Question (Yang) 8. Re: [Real World Haskell] Question (Lorenzo Bolla) ---------------------------------------------------------------------- Message: 1 Date: Wed, 22 Aug 2012 12:36:39 +0200 From: Chadda? Fouch? <chaddai.fou...@gmail.com> Subject: Re: [Haskell-beginners] Good style on "." and "$" pipeline? To: Felipe Almeida Lessa <felipe.le...@gmail.com> Cc: beginners@haskell.org Message-ID: <canfjzrznpoyr2ompn0p21g8pvcop1fg138uioij7dvwp+7b...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On Wed, Aug 22, 2012 at 3:41 AM, Felipe Almeida Lessa <felipe.le...@gmail.com> wrote: > On Tue, Aug 21, 2012 at 10:34 PM, koomi <ko...@hackerspace-bamberg.de> wrote: >> On 21.08.2012 22:43, Brent Yorgey wrote: >>> Having more than one $, like (f1 $ f2 $ fn $ arg), is frowned upon. >> Care to explain why this is considered bad? I don't see anything wrong >> with this. > > It's just a matter of taste. Personally, I usually prefer using many > ($)s rather than combining (.)s and ($)s on the same "phrase". It is a bit more than a matter of taste : the (.)s then one ($) style allows easier and clearer refactoring because each part of the function pipeline can be just copy pasted somewhere else, for instance you can get from : > bigFunc = f1 . f2 . f3 . f4 $ arg to > bigFunc = f1 . meaningfulFunc . f4 $ arg > > meaningfulFunc = f2 . f3 without rewriting a bit of your pipeline to change $ to . or add a point to meaningfulFunc (note that I ignore the monomorphism restriction here, I would give those function signatures anyway since they're top-level). I find this style makes it easier to reason about in a purely "pipelinesque" way (focused on functions and their combinations). -- Jeda? ------------------------------ Message: 2 Date: Wed, 22 Aug 2012 03:19:49 -0800 From: Christopher Howard <christopher.how...@frigidcode.com> Subject: Re: [Haskell-beginners] The Holy Trinity of Functional Programming To: Haskell Beginners <beginners@haskell.org> Message-ID: <5034c055.2090...@frigidcode.com> Content-Type: text/plain; charset="iso-8859-1" On 08/22/2012 01:27 AM, Costello, Roger L. wrote: > --------------------------------------------------------- > The Holy Trinity of Functional Programming > --------------------------------------------------------- > These three ideas constitute the holy trinity of functional programming: > > 1. User-defined recursive data types. > 2. Recursively defined functions over recursive data types. > 3. Proof by induction: show that some property P(n) holds for each element > of a recursive data type. > <snip> > > Although the infinite Nat value is not of much use, the same is not true of > the infinite values of other data types. > Please bear with us simpletons: But do you think you could provide a more "real world" example of an application of the "Holy Trinity" ideas? (One of those mysterious "other data types".) Not to say that recursive data types and proof by induction aren't fascinating in and of themselves... but sometimes it is difficult to make the connection to the practical programming process. -- frigidcode.com indicium.us -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 554 bytes Desc: OpenPGP digital signature URL: <http://www.haskell.org/pipermail/beginners/attachments/20120822/0783e7a6/attachment-0001.pgp> ------------------------------ Message: 3 Date: Wed, 22 Aug 2012 11:38:01 +0000 From: "Costello, Roger L." <coste...@mitre.org> Subject: Re: [Haskell-beginners] The Holy Trinity of Functional Programming To: "beginners@haskell.org" <beginners@haskell.org> Message-ID: <b5fee00b53cf054aa8439027e8fe17751e62f...@imcmbx04.mitre.org> Content-Type: text/plain; charset="us-ascii" Hello Christopher, > But do you think you could provide a > more "real world" example of an application > of the "Holy Trinity" ideas? A commonly cited real-world example that illustrates the first key idea (recursive data type) is a binary tree: data Tree = Node String Tree Tree | Leaf The elements of this data type include: Leaf Node "Root" Leaf Leaf Node "Root" (Node "Left" Leaf Leaf) (Node "Right" Leaf Leaf) And so forth. Common functions on this data type include insertions, deletions, traversal. I am not sure if there is a use for the infinite value of this data type. /Roger ------------------------------ Message: 4 Date: Wed, 22 Aug 2012 11:04:48 -0400 From: Brandon Allbery <allber...@gmail.com> Subject: Re: [Haskell-beginners] The Holy Trinity of Functional Programming To: "Costello, Roger L." <coste...@mitre.org> Cc: "beginners@haskell.org" <beginners@haskell.org> Message-ID: <CAKFCL4UKWnyaJbo3hsyZDU8zP=qb3aih8muap+znaov05y8...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" On Wed, Aug 22, 2012 at 7:38 AM, Costello, Roger L. <coste...@mitre.org>wrote: > > But do you think you could provide a > > more "real world" example of an application > > of the "Holy Trinity" ideas? > > A commonly cited real-world example that illustrates the first key idea > (recursive data type) is a binary tree: > I'd have used lists, since in Haskell we make use of infinite lists quite a bit; a simple example being zipping some list against [0..] (a list comprising an infinitely ascending sequence of numbers) to pair each item with its index. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120822/f6109c04/attachment-0001.htm> ------------------------------ Message: 5 Date: Wed, 22 Aug 2012 11:09:32 -0400 From: Brandon Allbery <allber...@gmail.com> Subject: Re: [Haskell-beginners] Good style on "." and "$" pipeline? To: koomi <ko...@hackerspace-bamberg.de> Cc: beginners@haskell.org Message-ID: <cakfcl4wxf+dvjxz2pmz0pazfwbdzr-gr8wnrnpgna9qeneb...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" On Tue, Aug 21, 2012 at 9:34 PM, koomi <ko...@hackerspace-bamberg.de> wrote: > On 21.08.2012 22:43, Brent Yorgey wrote: > > Having more than one $, like (f1 $ f2 $ fn $ arg), is frowned upon. > Care to explain why this is considered bad? I don't see anything wrong > with this. > Experientially, we see it a lot in #xmonad from beginners combining stuff together with a certain amont of cargo-culting (being beginners and usually quite unfamiliar with Haskell). I've been moving toward using ($) to separate logical "phrases" and (.) within the phrases, to make it easier to see which things go with which. Since layoutHook is rather agglutinative, this helps a lot. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120822/2f866916/attachment-0001.htm> ------------------------------ Message: 6 Date: Wed, 22 Aug 2012 11:57:11 -0400 From: "Edward Z. Yang" <ezy...@mit.edu> Subject: Re: [Haskell-beginners] The Holy Trinity of Functional Programming To: Brandon Allbery <allber...@gmail.com> Cc: "beginners@haskell.org" <beginners@haskell.org> Message-ID: <1345650945-sup-7654@javelin> Content-Type: text/plain; charset=UTF-8 Yes, but we can also use a similar style of inductive reasoning in the face of infinite types, called Scott induction [1]. There is also a perspective that infinite types (or so called 'codata') should be reasoned with 'coinduction', although the proof principles there are a little more esoteric. Cheers, Edward [1] http://blog.ezyang.com/2010/12/no-one-expects-the-scott-induction/ Excerpts from Brandon Allbery's message of Wed Aug 22 11:04:48 -0400 2012: > On Wed, Aug 22, 2012 at 7:38 AM, Costello, Roger L. <coste...@mitre.org>wrote: > > > > But do you think you could provide a > > > more "real world" example of an application > > > of the "Holy Trinity" ideas? > > > > A commonly cited real-world example that illustrates the first key idea > > (recursive data type) is a binary tree: > > > > I'd have used lists, since in Haskell we make use of infinite lists quite a > bit; a simple example being zipping some list against [0..] (a list > comprising an infinitely ascending sequence of numbers) to pair each item > with its index. > ------------------------------ Message: 7 Date: Wed, 22 Aug 2012 18:15:57 +0200 From: Yang <register.battlenet.com...@gmail.com> Subject: [Haskell-beginners] [Real World Haskell] Question To: beginners@haskell.org Message-ID: <503505bd.1090...@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi all, In chapter 4 in Real World Haskell comes there the first example of system I/O, namely `interactWith`. According to author, the right way is to compile and run program in system shell, though I have loaded source in GHCi and can't figure out how to invoke `main` interactively. Therefore the question is simply how can I call `main` that takes arguments in GHCi? Thanks. BTW: This is my first message to the group and if there is any restriction I violate in topics, I'd like to know. The example I mentioned can be found at the beginning of the web page followed by link http://book.realworldhaskell.org/read/functional-programming.html -- Best Regards Yang Zhao ------------------------------ Message: 8 Date: Wed, 22 Aug 2012 17:18:18 +0100 From: Lorenzo Bolla <lbo...@gmail.com> Subject: Re: [Haskell-beginners] [Real World Haskell] Question Cc: beginners@haskell.org Message-ID: <cadjgtrz1locfexowxk3wh0ptbk2-35cqd2qgg7vmhwzikot...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Try with: Prelude> :main L. On Wed, Aug 22, 2012 at 5:15 PM, Yang <register.battlenet.com...@gmail.com> wrote: > Hi all, > In chapter 4 in Real World Haskell comes there the first example of > system I/O, namely `interactWith`. According to author, the right way is to > compile and run program in system shell, though I have loaded source in GHCi > and can't figure out how to invoke `main` interactively. > > Therefore the question is simply how can I call `main` that takes > arguments in GHCi? Thanks. > > BTW: This is my first message to the group and if there is any restriction I > violate in topics, I'd like to know. The example I mentioned can be found at > the beginning of the web page followed by link > http://book.realworldhaskell.org/read/functional-programming.html > -- > Best Regards > Yang Zhao > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 50, Issue 24 *****************************************