[Haskell-cafe] GHC from source makes a great hardware test

2007-08-25 Thread Dave Bayer
I recently did the classic push a shopping cart down the aisle at Fry's to build a Core 2 Quad computer, with Linux swap and a soft raid array spread across three 750 GB sata hard disks. I had some potential first build issues, notably a mishap with the lawn of copper grass that passes for a 775

[Haskell-cafe] Best practice for embedding files in a GHC-compiled tool?

2008-02-06 Thread Dave Bayer
What is the best way to embed an arbitrary file in a Haskell program? I would like to use GHC to compile command-line tools to be used with OS X. I want the tool to be a single file, not a package or a directory, that makes no assumptions about what else is present. For example, it should

Re: [Haskell-cafe] Best practice for embedding files in a GHC-compiled tool?

2008-02-07 Thread Dave Bayer
On Feb 7, 2008, at 12:27 AM, [EMAIL PROTECTED] wrote: Are you assuming that the various users have GHC/Hugs installed? You know about scripting through the 'runhaskell' binary, right? I do, and I've used this. I don't want to do that here. Let me say this again: I am making no assumptions

[Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-22 Thread Dave Bayer
Hi all, I've been going over my code trying to get it all to compile with ghc -Wall -Werror, without introducing constructs that would make my code the laughing stock of the dynamic typing community. They already think we're nuts; my daydreams are of a more computer literate society

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-22 Thread Dave Bayer
On Jun 22, 2007, at 11:42 AM, David Roundy wrote: On Fri, Jun 22, 2007 at 11:37:15AM -0700, Dave Bayer wrote: GHC issues a Warning: Defaulting the following constraint(s) to type `Int' for the definition of z. Why don't you just use -fno-warn-type-defaults? ... ghc -Werr -Wall is a often

[Haskell-cafe] Compile-time here document facility

2007-06-22 Thread Dave Bayer
I couldn't find a compile-time here document facility, so I wrote one using Template Haskell: module HereDocs(hereDocs) where import Control.Exception import Language.Haskell.TH.Syntax getDoc :: String - [String] - (String,[String]) getDoc eof txt = let (doc,rest) = break (== eof) txt

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-22 Thread Dave Bayer
On Jun 22, 2007, at 2:46 PM, David Roundy wrote: I think of top-level type declarations as type-checked comments, rather than a seat-belt. It forces you to communicate to others what a function does, if that function may be used elsewhere. I like this. Although it can be cumbersome for

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-22 Thread Dave Bayer
On Jun 22, 2007, at 12:34 PM, Dave Bayer wrote: In particular, I always want defaulting errors, because sometimes I miss the fact that numbers I can count on my fingers are defaulting to Integer. So no one took the bait to actually offer me a shorter idiom, but I thought about the above

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-22 Thread Dave Bayer
On Jun 22, 2007, at 4:37 PM, David Roundy wrote: You get strongly-typed code whether or not you enable warnings. In my opinion it's delusional to think one is using strong typing if one doesn't enable warnings. All the puffing about the advantages of strong typing look pretty silly if

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-25 Thread Dave Bayer
On Jun 22, 2007, at 3:11 PM, Brandon S. Allbery KF8NH wrote: (1) any way to flag a pattern match as I know this is okay, don't warn about it without shutting off pattern match warnings completely? GHC doesn't issue warnings about patterns on the left of = For example, the following code

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-25 Thread Dave Bayer
On Jun 25, 2007, at 4:48 AM, Simon Peyton-Jones wrote: The intention is that it should be straightforward to suppress warnings. Simply add a type signature for 'z', or for the naked 3 in z's definition. I constructed my example from larger modules peppered with small integer constants;

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-25 Thread Dave Bayer
On Jun 25, 2007, at 8:15 AM, Simon Peyton-Jones wrote: i2 = 2 :: Int i3 = 3 :: Int The code {-# OPTIONS_GHC -Wall -Werror #-} module Main where i2 = 2 :: Int i3 = 3 :: Int main :: IO () main = putStrLn $ show (i2,i3) generates the errors Main.hs:5:0: Warning: Definition but no type

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-25 Thread Dave Bayer
On Mon, Jun 25, 2007 at 07:31:09PM +0100, Ian Lynagh wrote: I don't know if (^) in particular is what is causing you problems, but IMO it has the wrong type; just as we have (!!) :: [a] - Int - a genericIndex :: (Integral b) = [a] - b - a we should also have

Re: [Haskell-cafe] let vs do?

2007-06-28 Thread Dave Bayer
On Jun 28, 2007, at 12:17 PM, Greg Meredith wrote: Haskellians, Once you have a polymorphic let, why do you need 'let' in the base language, at all? Is it possible to formulate Haskell entirely with do-notation where there is a standard monad for let environments? Probably this was all

Re: [Haskell-cafe] advice: instantiating/duplicating modules

2007-06-29 Thread Dave Bayer
On Jun 29, 2007, at 10:07 AM, Nicolas Frisby wrote: I wrote a combination reader/writer monad (a la the RWS monad in the mtl) and I find myself wanting to use multiple instances of it in the same stack of transformers. The functional dependencies prevent this from working out. I found myself

Re: [Haskell-cafe] Parsers are monadic?

2007-06-30 Thread Dave Bayer
On Jun 30, 2007, at 6:31 AM, Claus Reinke wrote: has anyone else had similar experiences with expressive limitations of monadic programming? things that one might be able to work around, but that don't feel as natural or simple as they should be? things that one hasn't been able to express at

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-05 Thread Dave Bayer
On Jul 5, 2007, at 8:00 AM, Paul Moore wrote: It probably depends on your perspective. I've found lots of tasks that would be a simple library call in Python, but which require me to write the code myself in Haskell. Examples: * Calculate the MD5 checksum of a file How's this, only one line

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-05 Thread Dave Bayer
On Jul 5, 2007, at 9:52 AM, Paul Moore wrote: You're changing the problem from finding a Haskell library (which only needs to be installed on the development machine at compile time) to finding a 3rd party utility, which has to be installed at runtime ... Not a good trade-off. The

Re: [Haskell-cafe] A very edgy language (was: A very nontrivial parser)

2007-07-07 Thread Dave Bayer
On Jul 7, 2007, at 4:23 AM, Thomas Conway wrote: the performance model for haskell programs is at best inscrutable I punched my first Basic program by hand with a paper clip, in my high school library. Even after experiencing an APL interpreter at 19, it has taken half my life to fully

[Haskell-cafe] no-coding functional data structures via lazyness

2007-07-09 Thread Dave Bayer
Learning Haskell, the Prelude.ShowS type stood out as odd, exploiting the implementation of lazy evaluation to avoid explicitly writing an efficient concatenable list data structure. This felt like cheating, or at least like using a screwdriver as a crowbar, to be less judgmental.

Re: [Haskell-cafe] no-coding functional data structures via lazyness

2007-07-09 Thread Dave Bayer
On Jul 9, 2007, at 6:52 PM, Donald Bruce Stewart wrote: bayer: Learning Haskell, the Prelude.ShowS type stood out as odd, exploiting the implementation of lazy evaluation to avoid explicitly writing an efficient concatenable list data structure. See also

[Haskell-cafe] Re: Maintaining the community

2007-07-13 Thread Dave Bayer
Claus Reinke claus.reinke at talk21.com writes: will ultimately make its contents easier to find. but if you want to avoid answering questions again and again on the list, you need to improve the cache of answers. Bingo. On less technical forums, e.g. FlyerTalk, the do a search equivalent to

[Haskell-cafe] Re: Maintaining the community

2007-07-13 Thread Dave Bayer
Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk writes: Yes, the sheer volume of posts is definitely becoming a problem (for me, at least). As a newcomer I was stunned that this otherwise very sophisticated community was using an email list rather than a bulletin board. The shear torrent of

[Haskell-cafe] Re: Simple newbie question - Int and Integer

2007-07-13 Thread Dave Bayer
Gregory Propf gregorypropf at yahoo.com writes: So what the hell is the difference between them? Int and Integer. They aren't synonyms clearly. What's going on? http://www.haskell.org/haskellwiki/Learn_Haskell_in_10_minutes is a good starting point for answering this and similar

[Haskell-cafe] Re: [Math] Category theory research programs?

2007-07-13 Thread Dave Bayer
Creighton Hogg wchogg at gmail.com writes: Hi Haskell, Sorry to contribute to the noise but given that we've been talking about categories lately, I was wondering if anyone had any opinions on good universities for studying category theory. I'm trying to figure out where to apply for my

[Haskell-cafe] Re: Perfect shuffle on std. libs

2007-07-14 Thread Dave Bayer
of the authors of Dave Bayer, Persi Diaconis Trailing the dovetail shuffle to its lair Ann. Appl. Probab. 2 (1992), no. 2, 294-313 which found a closed form formula for the probabilities involved in riffle shuffles, how people shuffle e.g. playing bridge. This work was summarized as seven

[Haskell-cafe] Re: no-coding functional data structures via lazyness

2007-07-16 Thread Dave Bayer
apfelmus apfelmus at quantentunnel.de writes: While your observation that merge may create an implicit heap is true, it doesn't happen in your code :) When unfolding the foldr1, we get something like 2:.. `merge'` (3:.. `merge'` (5:.. `merge1` (...))) i.e. just a linear chain of

[Haskell-cafe] Re: Haskell for categorists

2007-07-16 Thread Dave Bayer
Miguel Mitrofanov miguelimo38 at yandex.ru writes: There are a lot of tutorials ensuring the reader that, although Haskell is based on category theory, you don't have to know CT to use Haskell. So, is there ANY Haskell tutorial for those who do know CT? If you know category theory, it's a

[Haskell-cafe] Re: Hints for Euler Problem 11

2007-07-20 Thread Dave Bayer
Ronald Guida ronguida at mindspring.com writes: I started looking at the Euler problems [1]. I had no trouble with problems 1 through 10, but I'm stuck on problem 11. I am aware that the solutions are available ([2]), but I would rather not look just yet. I am the author of that solution

[Haskell-cafe] Re: Code and Perf. Data for Prime Finders (was: Genuine Eratosthenes sieve)

2007-07-22 Thread Dave Bayer
Here is another prime sieve. It is about half the length of the fastest contributed code (ONeillPrimes) and nearly as fast until it blows up on garbage collection: % cat ONeillPrimes.hs | grep -v ^-- | wc 18511056306 % cat BayerPrimes.hs | grep -v ^-- | wc 85 566

[Haskell-cafe] Re: Code and Perf. Data for Prime Finders (was: Genuine Eratosthenes sieve)

2007-07-23 Thread Dave Bayer
As an exercise, trying to understand the beautiful paper Stream Fusion From Lists to Streams to Nothing at All Duncan Coutts, Roman Leshchinskiy and Don Stewart http://www.cse.unsw.edu.au/~dons/papers/CLS07.html

[Haskell-cafe] Re: Frustrating experience of a wannabe contributor

2007-07-23 Thread Dave Bayer
Simon Michael simon at joyful.com writes: Hi Andreas - very good problem report, thanks. I have just cleaned up the archive links at http://www.haskell.org/haskellwiki/Mailing_lists a bit. I added the ever-excellent gmane and an overview of all archives. Ok, this list was crushing my

[Haskell-cafe] Re: Code and Perf. Data for Prime Finders (was: Genuine Eratosthenes sieve)

2007-07-23 Thread Dave Bayer
It appears that at least on gmane, my posts to this thread ended up as singletons, breaking the thread. Here are the posts: http://article.gmane.org/gmane.comp.lang.haskell.cafe/26426 http://article.gmane.org/gmane.comp.lang.haskell.cafe/26466 ___

[Haskell-cafe] Re: Compile-time here document facility

2007-07-25 Thread Dave Bayer
Donald Bruce Stewart dons at cse.unsw.edu.au writes: bayer: I couldn't find a compile-time here document facility, so I wrote one using Template Haskell: Very nice! You should wrap it in a little .cabal file, and upload it to hackage.haskell.org, so we don't forget about it. Details

[Haskell-cafe] Avoiding boilerplate retrieving GetOpt cmd line args

2007-07-26 Thread Dave Bayer
Ok, I'm writing a command line tool, using System.Console.GetOpt to handle command line arguments. My Flags structure so far is data Flag = Filter String | DateFormat String | DocStart String | DocEnd String ... and I want to write accessor functions that return the strings

[Haskell-cafe] Re: Avoiding boilerplate retrieving GetOpt cmd line args

2007-07-27 Thread Dave Bayer
Neil Mitchell ndmitchell at gmail.com writes: then lookup, instead of just as the else clause. Thanks, all. After digesting what was on this thread as I woke up this morning, I ended up writing something rather close to this. I have a reusable wrapper around System.Console.GetOpt that adds

[Haskell-cafe] Re: Definition of the Haskell standard library

2007-07-30 Thread Dave Bayer
Chris Smith cdsmith at twu.net writes: Can someone clarify what's going on with the standard library in Haskell? ... sites for the thousandth time before realizing that so-and-so's GUI library hasn't actually been touched since they finished their class Short answer: Our system is very

[Haskell-cafe] Re: When is waitForProcess not necessary?

2007-08-03 Thread Dave Bayer
Bryan O'Sullivan bos at serpentine.com writes: Pardon me while I veer off-topic, but you could also use Pandoc to do this. No forking required. http://sophos.berkeley.edu/macfarlane/pandoc/ What I'm doing is neither Haskell nor Markdown specific; I allow any HTML markup filter that plays

[Haskell-cafe] Re: When is waitForProcess not necessary?

2007-08-03 Thread Dave Bayer
So I stared at the documentation in Control-Concurrent, learned about finally and MVar variables, and crossed the genes from the suggestions here to come up with runCommand :: String - String - IO (String,Bool) runCommand cmd input = do (inp,out,err,pid) - runInteractiveCommand