[Haskell-cafe] Re: Top 20 ``things'' to know in Haskell
Message: 9 Date: Mon, 7 Feb 2005 10:31:30 -0500 From: Jacques Carette [EMAIL PROTECTED] Subject: [Haskell-cafe] Top 20 ``things'' to know in Haskell To: haskell-cafe@haskell.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii The recent post of Graham Klyne (below) reminds me that I have meant to ask: is there a ``top 20'' things a serious programmer should know when writing code in Haskell? Of course there is a lot of programming language theory that would be great to know, but I mean really down-to-earth things like the 2 items below (module Maybe, the 'maybe' function). The Haskell libraries are quite large, and it is unrealistic to try to get familiar with all of them right away. But getting a ``small'' list would be very useful - I think of this as step 2 after one learns to get comfortable with a language. I had done this (for Maple) for training new hires at Maplesoft, and I definitely noticed that they became more idiomatic programmers faster this way. Jacques PS: of course, this could already exist on haskell.org and/or the Wiki, but not in an 'obvious' enough place as I missed it... Beginners might find this useful: http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/ It's guide to finding the right list function which leads you to it by asking you what you are trying to achieve. john -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Graham Klyne Sent: February 7, 2005 10:09 AM To: Yuri D'Elia; haskell-cafe@haskell.org Subject: [Haskell-cafe] Re: [Haskell] [newbye] 'Just a' You might also be interested in the library function 'maybe': http://www.haskell.org/onlinereport/standard-prelude.html#$vmaybe or maybe (sic) Maybe.fromMaybe in: http://www.haskell.org/onlinereport/maybe.html #g -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Top 20 ``things'' to know in Haskell
Were you thinking of something like [n] Things a Java Programmer Should Know About Ruby ? http://jimweirich.tadalist.com/lists/public/14055 Perhaps you'd like to start a page on the wiki. A link from here, maybe? http://haskell.org/hawiki/FrequentlyAskedQuestions The libraries I think I used the most when starting were: Data.List Data.Char Data.Maybe Data.Either System.IO (reading and writing files) System.Environment (for getArgs) Data.Set Data.FiniteMap (soon to be replaced) Of course, a lot of this is already in the Prelude, so you'll be using it indirectly. -Original Message- From: Jacques Carette [mailto:[EMAIL PROTECTED] Sent: 07 February 2005 15:31 To: haskell-cafe@haskell.org Subject: [Haskell-cafe] Top 20 ``things'' to know in Haskell The recent post of Graham Klyne (below) reminds me that I have meant to ask: is there a ``top 20'' things a serious programmer should know when writing code in Haskell? Of course there is a lot of programming language theory that would be great to know, but I mean really down-to-earth things like the 2 items below (module Maybe, the 'maybe' function). The Haskell libraries are quite large, and it is unrealistic to try to get familiar with all of them right away. But getting a ``small'' list would be very useful - I think of this as step 2 after one learns to get comfortable with a language. I had done this (for Maple) for training new hires at Maplesoft, and I definitely noticed that they became more idiomatic programmers faster this way. Jacques PS: of course, this could already exist on haskell.org and/or the Wiki, but not in an 'obvious' enough place as I missed it... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Graham Klyne Sent: February 7, 2005 10:09 AM To: Yuri D'Elia; haskell-cafe@haskell.org Subject: [Haskell-cafe] Re: [Haskell] [newbye] 'Just a' You might also be interested in the library function 'maybe': http://www.haskell.org/onlinereport/standard-prelude.html#$vmaybe or maybe (sic) Maybe.fromMaybe in: http://www.haskell.org/onlinereport/maybe.html #g - * Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. * ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Top 20 ``things'' to know in Haskell
On Wed, 9 Feb 2005, Bayley, Alistair wrote: Were you thinking of something like [n] Things a Java Programmer Should Know About Ruby ? http://jimweirich.tadalist.com/lists/public/14055 Perhaps you'd like to start a page on the wiki. A link from here, maybe? http://haskell.org/hawiki/FrequentlyAskedQuestions Is there also a Wiki page about things you should avoid? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Things to avoid (Was: Top 20 ``things'' to know in Haskell)
On Wed, 9 Feb 2005, Henning Thielemann wrote: On Wed, 9 Feb 2005, Bayley, Alistair wrote: Were you thinking of something like [n] Things a Java Programmer Should Know About Ruby ? http://jimweirich.tadalist.com/lists/public/14055 Perhaps you'd like to start a page on the wiki. A link from here, maybe? http://haskell.org/hawiki/FrequentlyAskedQuestions Is there also a Wiki page about things you should avoid? Since I couldn't find one, I started one on my own: http://www.haskell.org/hawiki/ThingsToAvoid I consider 'length', guards and proper recursion anchors. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Things to avoid (Was: Top 20 ``things'' to know in Haskell)
Henning Thielemann wrote: Since I couldn't find one, I started one on my own: http://www.haskell.org/hawiki/ThingsToAvoid I consider 'length', guards and proper recursion anchors. Very interesting. It would be nice to have reasoning for the n+k patterns thing. Guidelines that say 'don't do this' with no reason are far more confusing than no guidelines at all. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Contravariance
hello, ergh, its been a while since i looked at that paper, but basically for functors with +ve and -ve recursion, the cata(fold) and ana(unfold) morphisms work together. details can be found in for example Domains and lambda calculi by Amadio and Curien, or Andy Pitts' Relational properties of domains. Here is some Haskell code to illustrate what is going on: -- What 'G' does to objects. type G x y = x - y -- What 'G' does to arrows. fun:: (a - x, y - b) - (G x y - G a b) fun (j,i) f = i . f . j -- The fixpoint newtype A = A { unA :: A - A } -- The 'cata' and 'ana' are mutually recursive. univ :: (x - G y x, G x y - y) - (x - A,A - y) univ (j,i) = (ana,cata) where cata = i . fun (ana, cata) . unA ana = A . fun (cata, ana) . j hope this helps -Iavor On Tue, 8 Feb 2005 20:06:25 +0100, Johan Glimming [EMAIL PROTECTED] wrote: Hi I have a problem with contravariance in the bananas in space setting. If you take catamorphism from a function space such as A=A-A to a type such as BxC, then the negative occurrence of X in the functor GXY=X-Y swaps around BxC into B+C. This means that maybe in this particular case Meijer-Hutton's original Haskell code for cata/ana does not work, since the type for cata would force BxC and B+C to be the same type. I might be wrong about this, and I wonder anybody can comment on this. Med vänliga hälsningar / Yours Sincerely, Johan Glimming ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe