Re: [Haskell-cafe] How to write elegant Haskell programms?

2007-01-30 Thread John Hughes
to generate infinite random data-structures with it. John Hughes ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Debugging partial functions by the rules

2006-11-15 Thread John Hughes
From: Robert Dockins [EMAIL PROTECTED] It seems to me that every possible use of a partial function has some (possibly imagined) program invariant that prevents it from failing. Otherwise it is downright wrong. 'head', 'fromJust' and friends don't do anything to put that invariant in

Re: [Haskell-cafe] does the compiler optimize repeated calls?

2006-09-06 Thread John Hughes
On 9/6/06, Tamas K Papp [EMAIL PROTECTED] wrote: or does the compiler perform this optimization? More generally, if a function is invoked with the same parameters again (and it doesn't involve anything like monads), does does it makes sense (performancewise) to store the result somewhere?

Re: [Haskell-cafe] does the compiler optimize repeated calls?

2006-09-06 Thread John Hughes
John Hughes wrote: The trouble is that this isn't always an optimisation. Try these two programs: powerset [] = [[]] powerset (x:xs) = powerset xs++map (x:) (powerset xs) and powerset [] = [[]] powerset (x:xs) = pxs++map (x:) pxs where pxs = powerset xs Try computing length (powerset [1..n

[Haskell-cafe] Re: Exercise in point free-style

2006-09-01 Thread John Hughes
From: Julien Oster [EMAIL PROTECTED] Subject: [Haskell-cafe] Exercise in point free-style I was just doing Exercise 7.1 of Hal Daumé's very good Yet Another Haskell Tutorial. It consists of 5 short functions which are to be converted into point-free style (if possible). It's insightful and

Re: [Haskell-cafe] library sort

2006-03-08 Thread John Hughes
Am Samstag, 4. März 2006 21:30 schrieb Neil Mitchell: And a related question is: Which packages are searchable by Hoogle? The best answer to that is some. I intentionally excluded OpenGL and other graphics ones because they have a large interface and yet are not used by most people

[Haskell-cafe] Re: Library survey results

2006-03-08 Thread John Hughes
29% Parsec 19% wxHaskell 16% QuickCheck 16% haddock 12% Monadic Parser Combinators 11% Gtk2Hs 9% hs-plugins 8% HaXml 7% Data.* 7% Monad foundation classes 6% Arrows 6% HOpenGL The list includes all libraries named by more than 5% of respondents. Sure enough, wxHaskell and Gtk2Hs

Re: [Haskell-cafe] Why is $ right associative instead ofleftassociative?

2006-02-05 Thread John Hughes
Quoting Paul Hudak [EMAIL PROTECTED]: Actually, one of the main reasons that we chose (:) is that that's what Miranda used. So, at the time at least, it was not entirely clear what the de facto universal inter-language standard was. Phil Wadler argued for the ML convention at the time,

Re: [Haskell-cafe] Why is $ right associative instead ofleftassociative?

2006-02-05 Thread John Hughes
Lennart Augustsson wrote: I now think :: for type signatures was a bad mistake. I don't use lists very much. They are not the right data structure for many things. So : is not as common as :: in my code. I checked a small sample of code, about 2 lines of Haskell. It has about 1000

Re: [Haskell-cafe] Why is $ right associative instead ofleftassociative?

2006-02-05 Thread John Hughes
Cale Gibbard wrote: That said, I'd *really* like to see monad comprehensions come back, since they align better with the view that monads are container types, dual to the view that monads are computations, which is supported by the do-syntax. This view is actually much easier to teach (in my

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread John Hughes
-- Message: 1 Date: Wed, 21 Dec 2005 10:48:08 + From: Robin Green [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Re: Tutorial uploaded Beginners should start with non-monadic functions in order to later avoid IO

Re: [Haskell-cafe] Speed comparison?

2005-05-04 Thread John Hughes
a very one-sided view, ignoring the large effect that ease of programming can have on the final system's performance. John Hughes ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Instances of constrained datatypes

2005-04-07 Thread John Hughes
in 1999. Here's the link: http://www.cs.chalmers.se/~rjmh/Papers/restricted-datatypes.ps Getting the right dictionaries to the right place involves adding a concept of well-formed types, which perhaps is why it hasn't been taken up by the Simons... John Hughes

[Haskell-cafe] Re: Top 20 ``things'' to know in Haskell

2005-02-09 Thread John Hughes
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)

[Haskell-cafe] Re: Some random newbie questions

2005-01-10 Thread John Hughes
I seriously considered switching frlom Hugs to GHC for my introductory programming class this year, but in the end stayed with Hugs because of a single feature. I'm teaching beginning programmers, and for them at least, there is an overwhelming volume of names to learn -- what's that function?

[Haskell-cafe] Re: Adding Ord constraint to instance Monad Set?

2004-04-01 Thread John Hughes
| Constraints on datatype declarations are a misfeature of Haskell, and | have no useful effect. | | Is this the final conclusion? Yes, it is, I believe. Constraints on data type declarations are a mis-feature. I tried to get them removed, but there was some argument that they could be made

Re: Interpret haskell within haskell.

2002-12-20 Thread John Hughes
, in the hugs interpreter -- my tools only need to know how to work the hugs interface. As the language evolves, I can keep up just by installing a new version of hugs -- I have no parser and interpreter of my own to maintain. Easy and effective -- if a bit slow. John Hughes

Re: Writing a counter function

2002-06-30 Thread John Hughes
be deferred in the way I describe. If I remember rightly, OCaml allows type recursion of this sort, but restricts it to object types precisely to avoid these problems. John Hughes ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman

Re: problems figuring out what the type system is telling me

2002-06-08 Thread John Hughes
On Fri, 7 Jun 2002, Chris Moline wrote: ... two. i have also read what the hell are monads and monads for the working haskell programmer. i still do not get what i am doing wrong. getDepends :: String - [String] getDepends p = do handle - openFile (portsDir ++ p ++ /+CONTENTS)

Re: Lazy Parsing

2002-02-27 Thread John Hughes
There's a combinator which Phil Wadler called guarantee which makes a parser lazy -- guarantee p succeeds at once, with a result which will be produced, when demanded, by p. Many parsing libraries include it under one name or another... John ___

Re: Monad composition

2002-01-25 Thread John Hughes
? ^^ Probably in the same manner as with unsafePerformIO: it can break referential transparency. Indeed, unsafePerformIO m = runST (unsafeIOToST m) so they're just as unsafe as each other. John Hughes ___ Haskell-Cafe mailing list

Re: Monad composition

2002-01-24 Thread John Hughes
The easiest way to combine State and IO is using a monad transformer. There are some lecture notes which you might find useful at http://www.md.chalmers.se/~rjmh/Combinators/Monads/index.htm which refer to a library module

Re: Counting recursive calls

2001-11-11 Thread John Hughes
Hi all, got some questions on recursive functions. I got a simple recursive function (f3) In *some* situations I'll want to know how many recursive calls did it make. I came up with two simple implementations to do that (f1) and (f2) f [] w = (w,0)

Re: Hashtable ADT

2001-10-06 Thread John Hughes
. Encapsulated stateful operations like this fit very nicely with the functional style! Take a look at State in Haskell, John Launchbury and Simon Peyton Jones, http://www.cse.ogi.edu/~jl/Papers/stateThreads.ps which explains all of this at length. John Hughes

Re: let/where

2001-09-19 Thread John Hughes
. John Hughes ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

RE: How to force evaluation entirely?

2000-09-26 Thread John Hughes
rror "I am the pope!" but the seq form is nicer! John Hughes | -Original Message- | From: Michael Marte [mailto:[EMAIL PROTECTED]] | | | | I am trying to process a huge bunch of large XML files in order | to extract some dat