Re: [Haskell-cafe] Line noise

2008-09-22 Thread Andrew Coppin
Dan Piponi wrote: I suspect that most of the complaints about line noise stem from this - to beginners Haskell expressions just look like sequences of identifiers with no apparent grammar to bind them together. This was the exact complaint that some people voiced, yes. (The (.) and ($)

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Andrew Coppin
Mads Lindstrøm wrote: Andrew Coppin wrote: Idiomatic Haskell seems to consist *only* of single-letter variable names. The more abstract (generic) thing gets, the less likely you will be able to find a telling name. And if you cannot find a telling name, you can just as well make it

Re: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Andrew Coppin
Don Stewart wrote: Thanks to those guys who've submitted parallel programs to the language benchmarks game, we're climbing up the rankings, now in 3rd, and ahead of C :) http://shootout.alioth.debian.org/u64q/benchmark.php?test=alllang=all Yay! This makes me very happy. ;-)

Re: [Haskell-cafe] ANNOUNCE: citeproc-hs, a Haskell implementation of the Citation Style Language designed for Pandoc

2008-09-22 Thread Andrea Rossato
Hi Gwern, On Fri, Sep 19, 2008 at 09:01:46PM -0400, Gwern Branwen wrote: Hi Andrea. So I was looking at the README. Does citeproc-hs only support adding refs from a .xml file when one's written in Pandoc markdown? That is, I don't see how I could take a .lhs file and a .bib file and produce

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Stephan Friedrichs
Andrew Coppin wrote: [...] - Variable names such as x and f aren't fabulously helpful to lost programmers trying to find their way. I'm not a fan of cryptic variable names, either, and I try to use descriptive names wherever I can. But in Haskell... - ... you often have variables, which have

RE: [Haskell-cafe] readFile and closing a file

2008-09-22 Thread Henning Thielemann
On Wed, 17 Sep 2008, Mitchell, Neil wrote: I tend to use openFile, hGetContents, hClose - your initial readFile like call should be openFile/hGetContents, which gives you a lazy stream, and on a parse error call hClose. I could use a function like withReadFile :: FilePath - (Handle - IO a)

[Haskell-cafe] Re: [m..n] question

2008-09-22 Thread Jon Fairbairn
Richard A. O'Keefe [EMAIL PROTECTED] writes: Erlang's equivalent of [m..n] is lists:seq(M, N), which is currently defined to raise an exception when N M. In particular, lists:seq(1, N) returns a list of length N when N 0, but not when N = 0. I'm currently arguing that lists:seq(1, 0)

Re: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Manlio Perillo
Don Stewart ha scritto: Thanks to those guys who've submitted parallel programs to the language benchmarks game, we're climbing up the rankings, now in 3rd, and ahead of C :) This is cheating, IMHO. Some test comparisons are unfair. The first problem is with the thread-ring benchmark.

Re: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Thomas Davie
On 22 Sep 2008, at 11:46, Manlio Perillo wrote: Don Stewart ha scritto: Thanks to those guys who've submitted parallel programs to the language benchmarks game, we're climbing up the rankings, now in 3rd, and ahead of C :) This is cheating, IMHO. Some test comparisons are unfair. The

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Ketil Malde
Andrew Coppin [EMAIL PROTECTED] writes: Idiomatic Haskell seems to consist *only* of single-letter variable names. Good thing, too. Well, qsort (element : list) would be maximally intuitive, but who's going to implement it like that? ;-) Why not listElement : restOfList ? The rationale

[Haskell-cafe] Re: ANNOUNCE: protocol-buffers-0.2.9 for Haskell is ready

2008-09-22 Thread Chris Kuklewicz
I am cross-posting this message to several lists. I had learned the trick before the documentation was updated. It seems I have used a very unreliable trick. And the use castToSTUArray suggested alternative is a really poor one since I am not using arrays at all. Who can suggest a way to

[Haskell-cafe] RE: readFile and closing a file

2008-09-22 Thread John Lato
On Wed, 17 Sep 2008, Mitchell, Neil wrote: I tend to use openFile, hGetContents, hClose - your initial readFile like call should be openFile/hGetContents, which gives you a lazy stream, and on a parse error call hClose. I could use a function like withReadFile :: FilePath - (Handle - IO

Re: [Haskell-cafe] Re: ANNOUNCE: protocol-buffers-0.2.9 for Haskell is ready

2008-09-22 Thread Yitzchak Gale
Chris Kuklewicz wrote: Who can suggest a way to cast from Float to Word32 and Double to Word64 using ghc? The actual task is that I need to write out the Float as a little endian sequence of four bytes and also be able to read it back in. The writing and reading are done in Put and Get

[Haskell-cafe] Re: Climbing up the shootout...

2008-09-22 Thread ChrisK
And, though I had never seen it before, the current winner for speed is ATS ( http://www.ats-lang.org/ ) which is dependently-typed functional language. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Manlio, Monday, September 22, 2008, 1:46:55 PM, you wrote: This is cheating, IMHO. Some test comparisons are unfair. this overall test is uselles for speed comparison. afair, there are only 2-3 programs whose speed isn't heavily depend on libraries. in DNA test, for example, Tcl (or

Re: [Haskell-cafe] Re: ANNOUNCE: protocol-buffers-0.2.9 for Haskell is ready

2008-09-22 Thread Bulat Ziganshin
Hello Chris, Monday, September 22, 2008, 2:48:16 PM, you wrote: used a very unreliable trick. And the use castToSTUArray suggested alternative is a really poor one since I am not using arrays at all. castToSTUArray does the same as your code, only in ST monad so you can skip unsafePerformIO

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Daniel Fischer
Am Montag, 22. September 2008 08:32 schrieb Andrew Coppin: However, I will grant you that Map k v, could have used longer type variables. But we are not alone with using one letter type variable names http://java.sun.com/javase/6/docs/api/java/util/HashMap.html . And frankly, in this

Re: [Haskell-cafe] Re: Munging wiki articles with tagsoup

2008-09-22 Thread Neil Mitchell
Hi For no escaping of any characters, or more likely do something like , and conversions. See the docs: http://hackage.haskell.org/packages/archive/tagsoup/0.6/doc/html/Text-HTML-TagSoup-Render.html Well, I did look at that Haddock page, as well as the others. But honestly, just a bare

Re: [Haskell-cafe] Line noise

2008-09-22 Thread david48
On Sun, Sep 21, 2008 at 10:04 PM, Claus Reinke [EMAIL PROTECTED] wrote: Once your readers understand your code, you can add the one-liner and ask for applause This should make it HWN's quotes of the week ! ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Ropes

2008-09-22 Thread Rafael Gustavo da Cunha Pereira Pinto
That is a good idea! If I implement head, tail, take drop operations, I can use my KMP implementation out of the box... On Sun, Sep 21, 2008 at 11:10, Nicolas Pouillard [EMAIL PROTECTED] wrote: Excerpts from Rafael Gustavo da Cunha Pereira Pinto's message of Sat Sep 20 12:54:26 +0200 2008:

Re: [Haskell-cafe] RE: readFile and closing a file

2008-09-22 Thread Don Stewart
jwlato: On Wed, 17 Sep 2008, Mitchell, Neil wrote: I tend to use openFile, hGetContents, hClose - your initial readFile like call should be openFile/hGetContents, which gives you a lazy stream, and on a parse error call hClose. I could use a function like withReadFile :: FilePath

Re: [Haskell-cafe] Updated formlets sample?

2008-09-22 Thread Martin Huschenbett
Hi Chris, you're absolutely right. The mistake was in the where-part of withForm. The function handleOk' gets an environment d as argument but uses an extractor that was created without passing d to runFormState. I've put a corrected version on hpaste [1] and also posted it to the wiki on

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Sebastian Sylvan
On Mon, Sep 22, 2008 at 1:50 PM, Daniel Fischer [EMAIL PROTECTED]wrote: Am Montag, 22. September 2008 08:32 schrieb Andrew Coppin: However, I will grant you that Map k v, could have used longer type variables. But we are not alone with using one letter type variable names

Re: Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Simon Brenner
On Mon, Sep 22, 2008 at 2:07 PM, Bulat Ziganshin [EMAIL PROTECTED] wrote: this overall test is uselles for speed comparison. afair, there are only 2-3 programs whose speed isn't heavily depend on libraries. in DNA test, for example, Tcl (or PHP?) was leader just because it has better regexp

Re[4]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Simon, Monday, September 22, 2008, 9:03:52 PM, you wrote: With bytestrings, unboxed arrays, light-weight threads and other tricks, we can usually replace all those ugly low-level programs with nice high-level haskell ones i don't think that these 3 libs allows to write high-level

[Haskell-cafe] hGetContents and lazyness

2008-09-22 Thread Max Vasin
Hello, haskellers! Suppose we have function (it filters package filenames from apt Packages file): getPackageList :: FilePath - IO [FilePath] getPackageList packageFile = withFile packageFile ReadMode $ \h - do c - hGetContents h

Re: Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Isaac Gouy
--- Simon Brenner [EMAIL PROTECTED] wrote: On Mon, Sep 22, 2008 at 2:07 PM, Bulat Ziganshin [EMAIL PROTECTED] wrote: this overall test is uselles for speed comparison. afair, there are only 2-3 programs whose speed isn't heavily depend on libraries. in DNA test, for example, Tcl (or

Re: Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Don Stewart
igouy2: --- Simon Brenner [EMAIL PROTECTED] wrote: On Mon, Sep 22, 2008 at 2:07 PM, Bulat Ziganshin [EMAIL PROTECTED] wrote: this overall test is uselles for speed comparison. afair, there are only 2-3 programs whose speed isn't heavily depend on libraries. in DNA test, for

Fwd: [Haskell-cafe] hGetContents and lazyness

2008-09-22 Thread Rafael Gustavo da Cunha Pereira Pinto
-- Forwarded message -- From: Rafael Gustavo da Cunha Pereira Pinto [EMAIL PROTECTED] Date: Mon, Sep 22, 2008 at 15:46 Subject: Re: [Haskell-cafe] hGetContents and lazyness To: Max Vasin [EMAIL PROTECTED] Why don't you use OpenFile? getPackageList packageFile = do

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Luke Palmer
On Sun, Sep 21, 2008 at 1:10 PM, Andrew Coppin [EMAIL PROTECTED] wrote: I posted a snippet of code which included the phrase mapM_ (\(n,v) - putStrLn $ [ ++ show n ++ ] = ++ show v) (zip [0..] vs) To somebody familiar with Haskell, that is as clear as day. But to a newbie... well *you*

Re: Re[4]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Graham Fawcett
On Mon, Sep 22, 2008 at 1:12 PM, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Simon, Monday, September 22, 2008, 9:03:52 PM, you wrote: With bytestrings, unboxed arrays, light-weight threads and other tricks, we can usually replace all those ugly low-level programs with nice high-level

Re[6]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Graham, i don't think that these 3 libs allows to write high-level high-performance code in *most* cases. just for example, try to write wc without using words. To a newbie, that's a cryptic statement. Are you saying that these libs aren't needed to make a high-performance wc, and

Re[2]: [Haskell-cafe] Line noise

2008-09-22 Thread Bulat Ziganshin
Hello Luke, Monday, September 22, 2008, 11:00:12 PM, you wrote: mapM_ (\(n,v) - putStrLn $ [ ++ show n ++ ] = ++ show v) (zip [0..] vs) forM_ (zip [0..] vs) $ \(n,v) - putStrLn $ [ ++ show n ++ ] = ++ show v for (zip [0..] vs) $ \(n,v) - do putStrLn $ [ ++ show n ++ ] = ++ show

Re: [Haskell-cafe] hGetContents and lazyness

2008-09-22 Thread Micah Cowan
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Max Vasin wrote: Hello, haskellers! Suppose we have function (it filters package filenames from apt Packages file): getPackageList :: FilePath - IO [FilePath] getPackageList packageFile = withFile packageFile ReadMode $

[Haskell-cafe] how do i use quickcheck in the IO monad?

2008-09-22 Thread Anatoly Yakovenko
If i have functions in the IO monad, is there a way to use quickcheck to test them? I have a bunch of C bindings that unfortunately are not safe. But i would like to be able to use QuickCheck to test them. Thanks, Anatoly ___ Haskell-Cafe mailing list

Re: Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Don Stewart
igouy2: --- Simon Brenner [EMAIL PROTECTED] wrote: On Mon, Sep 22, 2008 at 2:07 PM, Bulat Ziganshin [EMAIL PROTECTED] wrote: this overall test is uselles for speed comparison. afair, there are only 2-3 programs whose speed isn't heavily depend on libraries. in DNA test, for

Re: Re[6]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Isaac Gouy
--- Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Graham, i don't think that these 3 libs allows to write high-level high-performance code in *most* cases. just for example, try to write wc without using words. To a newbie, that's a cryptic statement. Are you saying that these

Re: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Manlio Perillo
Don Stewart ha scritto: [...] I've now submitted a Text.Regex.PCRE parallelised entry written by Tim Newsham. It is by far the fastest haskell regex entry so far (down to 9s on quad core, from 100+ seconds on single core for the old entry),

Re[8]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Isaac, Monday, September 22, 2008, 11:49:30 PM, you wrote: i mean that naive haskell code is very slow and 3 or 5 or twelve libs can't solve the problem of ghc generating slow code Is there something particularly fascinating about naive code written in any language? yes, in asm

Re: Re[8]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Jonathan Cast
On Tue, 2008-09-23 at 00:20 +0400, Bulat Ziganshin wrote: Hello Isaac, Monday, September 22, 2008, 11:49:30 PM, you wrote: i mean that naive haskell code is very slow and 3 or 5 or twelve libs can't solve the problem of ghc generating slow code Is there something particularly

Re: [Haskell-cafe] Re: having fun with GADT's

2008-09-22 Thread Anatoly Yakovenko
data Nat a where Z :: Nat a S :: Nat a - Nat (S a) data Z data S a I thought I was getting this, but this part is confusing. What exactly does declaring data Z do? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re[10]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Jonathan, Tuesday, September 23, 2008, 12:30:19 AM, you wrote: yes, in asm number of instructions executed more or less define number of CPU cycles used. well, i more or less know all this stuff. but are you really compare to Haskell??? does Haskell programs typically written in

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Andrew Coppin
Stephan Friedrichs wrote: Andrew Coppin wrote: [...] - Variable names such as x and f aren't fabulously helpful to lost programmers trying to find their way. I'm not a fan of cryptic variable names, either, and I try to use descriptive names wherever I can. But in Haskell... - ...

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Andrew Coppin
Ketil Malde wrote: The rationale for having long names is that you have too many names, and too large a scope to keep track of them all in your head. Needing long names is a symptom that your code is too complex, and that you should refactor it. Well, yeah. In Haskell, functions tend to be

Re: [Haskell-cafe] Re: having fun with GADT's

2008-09-22 Thread Frank Wilson
Someone could probably give a better explanation but I'll give this a shot! :) What you are actually doing is defining a family of types. Every value in the type Nat a has it's own type. For instance Z has type Nat Z, (S Z) or one has type Nat (S Z), (S (S Z)) has type Nat (S (S Z)) and

Re: Re[10]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Jonathan Cast
On Tue, 2008-09-23 at 00:46 +0400, Bulat Ziganshin wrote: Hello Jonathan, Tuesday, September 23, 2008, 12:30:19 AM, you wrote: yes, in asm number of instructions executed more or less define number of CPU cycles used. well, i more or less know all this stuff. but are you

Re: [Haskell-cafe] how do i use quickcheck in the IO monad?

2008-09-22 Thread Don Stewart
aeyakovenko: If i have functions in the IO monad, is there a way to use quickcheck to test them? I have a bunch of C bindings that unfortunately are not safe. But i would like to be able to use QuickCheck to test them. Typically, via unsafePerformIO, and check the invariants that need to

Re: [Haskell-cafe] Re: having fun with GADT's

2008-09-22 Thread Luke Palmer
On Mon, Sep 22, 2008 at 2:42 PM, Anatoly Yakovenko [EMAIL PROTECTED] wrote: data Nat a where Z :: Nat a S :: Nat a - Nat (S a) data Z data S a I thought I was getting this, but this part is confusing. What exactly does declaring data Z do? Well, in Haskell without closed type

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Jake Mcarthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Most people seem far more confused by what a fold might be. A fold by any other name would smell as sweet. ;) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkjYE7kACgkQTkPEVFd3yxh7HwCfVzopoOCgg49YI0Y88g9rjXqI

Re: Re[6]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Donnie Jones
Hello Bulat, On Mon, Sep 22, 2008 at 3:09 PM, Bulat Ziganshin [EMAIL PROTECTED]wrote: Hello Graham, i don't think that these 3 libs allows to write high-level high-performance code in *most* cases. just for example, try to write wc without using words. To a newbie, that's a cryptic

Re[8]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Donnie, Tuesday, September 23, 2008, 2:53:17 AM, you wrote: i mean that naive haskell code is very slow and 3 or 5 or twelve libs can't solve the problem of ghc generating slow code I'm fairly new to Haskell and the Haskell community, but I can say from my experience of hacking on

[Haskell-cafe] Live twittering from ICFP

2008-09-22 Thread Don Stewart
ICFP is on now, for those wondering why the list is a bit quiet :) http://www.icfpconference.org/icfp2008/schedule.html I'm doing live updates of events at ICFP/Haskell Symposium here in Canada. http://twitter.com/galoisinc So you can follow events remotely. Cheers, Don

Re: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Don Stewart
bulat.ziganshin: Hello Donnie, Tuesday, September 23, 2008, 2:53:17 AM, you wrote: i mean that naive haskell code is very slow and 3 or 5 or twelve libs can't solve the problem of ghc generating slow code I'm fairly new to Haskell and the Haskell community, but I can say from my

Re: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Gwern Branwen
On 2008.09.22 21:12:06 +0400, Bulat Ziganshin [EMAIL PROTECTED] scribbled 0.5K characters: Hello Simon, Monday, September 22, 2008, 9:03:52 PM, you wrote: With bytestrings, unboxed arrays, light-weight threads and other tricks, we can usually replace all those ugly low-level programs with

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Gwern, Tuesday, September 23, 2008, 3:33:02 AM, you wrote: high-performance code in *most* cases. just for example, try to write wc without using words http://haskell.org/haskellwiki/Wc seems to do fine; you'll notice it drops lines after the first version. actually it counts lines

Re: Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Chaddaï Fouché
2008/9/23 Bulat Ziganshin [EMAIL PROTECTED]: http://haskell.org/haskellwiki/Wc seems to do fine; you'll notice it drops lines after the first version. actually it counts lines using built-in function. you may find that naive C is 6x fatser than naive Haskell and difference is so small only

Re: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Don Stewart
bulat.ziganshin: when gcc developers will start to add to C libraries functions performing shootout benchmarks we will continue this discussion :D atoi(3). -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Don, Tuesday, September 23, 2008, 4:22:19 AM, you wrote: bulat.ziganshin: when gcc developers will start to add to C libraries functions performing shootout benchmarks we will continue this discussion :D atoi(3). it isn't the same as readInt which was added specifically for this

Re: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Don Stewart
bulat.ziganshin: Hello Don, Tuesday, September 23, 2008, 4:22:19 AM, you wrote: bulat.ziganshin: when gcc developers will start to add to C libraries functions performing shootout benchmarks we will continue this discussion :D atoi(3). it isn't the same as readInt which was

Re: Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Chaddaï Fouché
2008/9/23 Bulat Ziganshin [EMAIL PROTECTED]: Hello Don, Tuesday, September 23, 2008, 4:22:19 AM, you wrote: bulat.ziganshin: when gcc developers will start to add to C libraries functions performing shootout benchmarks we will continue this discussion :D atoi(3). it isn't the same as

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Brian Hurt
On Sun, 21 Sep 2008, wren ng thornton wrote: Even with functionalists ---of the OCaml and SML ilk--- this use of spaces can be confusing if noone explains that function application binds tighter than all operators. Bwuh? Ocaml programmers certainly know that application binds tighter

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Don, Tuesday, September 23, 2008, 4:36:55 AM, you wrote: it isn't the same as readInt which was added specifically for this test. it doesn't support arbitrary-size streams and doesn't return rest of stream Hmm? That is wrong. These functions explicitly work on arbitrarily long lazy

Re[4]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Chaddaï, Tuesday, September 23, 2008, 4:39:18 AM, you wrote: it isn't the same as readInt which was added specifically for this test. it doesn't support arbitrary-size streams and doesn't return rest of stream I think we should write all the entries in Haskell98 and disable any

Re: Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Sterling Clover
At the risk of getting sucked into a silly discussion, I'd like to point out that the c code uses the following really simple and naive function: http://sourceware.org/cgi-bin/cvsweb.cgi/libc/stdlib/strtol.c?rev=1.42.2.2content-type=text/x-cvsweb-markupcvsroot=glibc

Re: [Haskell-cafe] Line noise

2008-09-22 Thread Jason Dagit
On Mon, Sep 22, 2008 at 6:27 PM, Brian Hurt [EMAIL PROTECTED] wrote: On Sun, 21 Sep 2008, wren ng thornton wrote: Even with functionalists ---of the OCaml and SML ilk--- this use of spaces can be confusing if noone explains that function application binds tighter than all operators. Bwuh?

[Haskell-cafe] Is there already an abstraction for this?

2008-09-22 Thread Jeremy Shaw
Hello, I am trying to figure out if there is an existing abstraction I am missing here. I have an expression data-type: data Expr = Quotient Expr Expr | Product Expr Expr | Sum Expr Expr | Difference Expr Expr | Lit Double | Var Char deriving (Eq, Ord, Data,

Re: [Haskell-cafe] Is there already an abstraction for this?

2008-09-22 Thread Dan Weston
I can implement these with some 'sugar' as: identity (Sum (Lit 0) a)= a identity (Sum a (Lit 0))= a identity (Difference a (Lit 0)) = a identity (Product a (Lit 1))= a identity (Product (Lit 1) a)= a identity (Quotient a (Lit 1)) = a identity a

Re: [Haskell-cafe] Is there already an abstraction for this?

2008-09-22 Thread Dan Weston
Oops, never mind. This is just the shallow application you referred to. Too fast with that send button! Dan Weston wrote: I can implement these with some 'sugar' as: identity (Sum (Lit 0) a)= a identity (Sum a (Lit 0))= a identity (Difference a (Lit 0)) = a

Re: [Haskell-cafe] Re: having fun with GADT's

2008-09-22 Thread Anatoly Yakovenko
data Nat a where Z :: Nat a S :: Nat a - Nat (S a) data Z data S a n00 = Z n01 = S n00 n02 = S n01 n03 = S n02 n04 = S n03 data MaxList t where Nil :: MaxList a Cons :: Nat a - MaxList a - MaxList a a = Cons n02 $ Cons n02 $ Cons n01 $ Nil --- :t a gives forall a.

Re: [Haskell-cafe] Is there already an abstraction for this?

2008-09-22 Thread Sebastian Fischer
Hi Jeremy, There are some approaches that support such generic transformations. The simplest is probably Uniplate by Neil Mitchell: http://www-users.cs.york.ac.uk/~ndm/uniplate/ The function 'rewrite' is what you are looking for. If you change the definition of 'identity' to:

Re: [Haskell-cafe] Re: having fun with GADT's

2008-09-22 Thread David Menendez
On Mon, Sep 22, 2008 at 10:20 PM, Anatoly Yakovenko [EMAIL PROTECTED] wrote: Is there a way to define a function that only takes a list with a max of 1? Because only1 :: MaxList (S a) - String only1 _ = only1 will work over a = Cons n02 $ Cons n02 $ Cons n01 $ Nil without any problems

Re: [Haskell-cafe] Re: having fun with GADT's

2008-09-22 Thread Anatoly Yakovenko
type One = S Z type Two = S One etc. why does: data Nat a where Z :: Nat a S :: Nat a - Nat (S a) data Z data S a type One = S Z n00 = Z n01::One = S n00 give me: test.hs:10:11: Couldn't match expected type `One' against inferred type `Nat (S a)' In the

Re: [Haskell-cafe] Bird-style and blank lines

2008-09-22 Thread Ryan Ingram
Oops, meant to send this to the whole list. You can add -optL -q to your ghc command line to disable that behavior; blank lines will no longer be required. -- ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: having fun with GADT's

2008-09-22 Thread Ryan Ingram
Try n01 :: Nat One -- ryan On Mon, Sep 22, 2008 at 8:10 PM, Anatoly Yakovenko [EMAIL PROTECTED] wrote: type One = S Z type Two = S One etc. why does: data Nat a where Z :: Nat a S :: Nat a - Nat (S a) data Z data S a type One = S Z n00 = Z n01::One = S n00 give me:

Re: [Haskell-cafe] Bird-style and blank lines

2008-09-22 Thread Paulo Tanimoto
On Mon, Sep 22, 2008 at 11:27 PM, Ryan Ingram [EMAIL PROTECTED] wrote: Oops, meant to send this to the whole list. You can add -optL -q to your ghc command line to disable that behavior; blank lines will no longer be required. This little gem that Ryan found was exactly what I was looking

Re: [Haskell-cafe] Updated formlets sample?

2008-09-22 Thread Chris Eidhof
Ah yes, I just adjusted the code until it compiled, I must confess I didn't check whether it actually worked ;). Thanks for the wiki-update! -chris On 22 sep 2008, at 09:47, Martin Huschenbett wrote: Hi Chris, you're absolutely right. The mistake was in the where-part of withForm. The

Re: [Haskell-cafe] Is there already an abstraction for this?

2008-09-22 Thread Nicolas Pouillard
Excerpts from Jeremy Shaw's message of Mon Sep 22 18:46:22 -0700 2008: Hello, I am trying to figure out if there is an existing abstraction I am missing here. You can try to pick some information in the mocac [1] project, that is for OCaml. Moca is a general construction functions

[Haskell-cafe] what is the magic hash?

2008-09-22 Thread Jason Dusek
It is not much covered in the docs. It has something to do with magic triggered by a postfix octothorpe? -- _jsn |...docs.| http://haskell.org/ghc/docs/latest/html/users_guide/flag-reference.html ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] what is the magic hash?

2008-09-22 Thread Derek Elkins
On Mon, 2008-09-22 at 21:58 -0700, Jason Dusek wrote: It is not much covered in the docs. It has something to do with magic triggered by a postfix octothorpe? All it does is allow them in identifiers. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] what is the magic hash?

2008-09-22 Thread Jason Dusek
Derek Elkins [EMAIL PROTECTED] wrote: Jason Dusek wrote: It is not much covered in the docs. It has something to do with magic triggered by a postfix octothorpe? All it does is allow them in identifiers. That's it? So it's for use in conjunction with primitive types, I guess (those

Re: [Haskell-cafe] Re: having fun with GADT's

2008-09-22 Thread David Menendez
On Mon, Sep 22, 2008 at 11:10 PM, Anatoly Yakovenko [EMAIL PROTECTED] wrote: type One = S Z type Two = S One etc. why does: data Nat a where Z :: Nat a S :: Nat a - Nat (S a) data Z data S a type One = S Z n00 = Z n01::One = S n00 give me: test.hs:10:11: Couldn't match