[Haskell-cafe] Re: Tiny documentation request

2007-09-12 Thread manu
On Sep 11, 2007, at 9:58 PM, Miguel Mitrofanov wrote: Well, I'm not a web designer, but I did work with few of them, and it seems to me that you either create a table design in two hours or spend three days trying to create a CSS one and THEN create a table design in two hours. That's an

Re: [Haskell-cafe] Is take behaving correctly?

2007-09-12 Thread rahn
take 1000 [1..3] still yields [1,2,3] You can think about take n as: Take as much as possible, but at most n elements. This behavior has some nice properties as turned out by others, but there are some pitfalls. We have length . take n /= const n in general, instead only length . take

Re: [Haskell-cafe] Is take behaving correctly?

2007-09-12 Thread Conor McBride
Hi folks On 12 Sep 2007, at 00:38, Brent Yorgey wrote: On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote: Hi take 1000 [1..3] still yields [1,2,3] I thought it was supposed to return an error. [..] If for some reason you want a version that does return an error in that situation, you could

[Haskell-cafe] Developing XPCOM components (Firefox extensions) in Haskell

2007-09-12 Thread Pasqualino 'Titto' Assini
Hello, I wondered if anyone could advice on how to develop XPCOM components in Haskell. I am aware that HDirect supports COM and that there are some similarities with XPCOM but I do not have the time to extend/fix HDirect to support XPCOM. Would using FFI directly be simpler? What problems

RE: [Haskell-cafe] Developing XPCOM components (Firefox extensions) inHaskell

2007-09-12 Thread Bayley, Alistair
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pasqualino 'Titto' Assini I wondered if anyone could advice on how to develop XPCOM components in Haskell. I am aware that HDirect supports COM and that there are some similarities with XPCOM but I do not have the

[Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread ChrisK
Conor McBride wrote: Hi folks On 12 Sep 2007, at 00:38, Brent Yorgey wrote: On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote: Hi take 1000 [1..3] still yields [1,2,3] I thought it was supposed to return an error. [..] If for some reason you want a version that does return an error in

[Haskell-cafe] Haskell and State Monad.

2007-09-12 Thread VinyleEm
Hello all, I am Vinay Emani, new to this forum. I am doing an academic project of writing an assembler cum linker in Haskell as part of building a compiler set written entirely in Haskell. Since i am new to the language, i thought it would do me good to look at some of the existing haskell code,

[Haskell-cafe] Re: Tiny documentation request

2007-09-12 Thread Simon Marlow
manu wrote: On Sep 11, 2007, Simon Marlow wrote: Please, please, someone do this for me. I tried, and failed, to get the layout right for the contents list in all browsers at the same time. The semantics of CSS is beyond my comprehension. Cheers, Simon Hi Simon, On the page

RE: [Haskell-cafe] Building production stable software in Haskell

2007-09-12 Thread Peter Verswyvelen
Thanks for all the info. It's really good news that code coverage is now part of the GHC compiler! Any more info on that deep seq? I can't find it in the libraries that come with GHC 6.6.1. It seems to be part of Control.Strategies.DeepSeq of HXT. This is a separate download? Intuitively, I

Re: [Haskell-cafe] Haddock/hscolour integration broken on Hackage?

2007-09-12 Thread Roberto Zunino
Malcolm Wallace wrote: David Menendez [EMAIL PROTECTED] writes: I was looking at the Data.Binary documentation[1] on Hackage, and I've noticed some problems with the associated source listings[2]. First, none of the Source links work. They all refer to fragment IDs (e.g., #Binary) that are

Re: [Haskell-cafe] Haddock/hscolour integration broken on Hackage?

2007-09-12 Thread Roberto Zunino
Roberto Zunino wrote: Would be enough to use the %xx encoding of parenthesis? Would you instead use another prefix (it is enough that no haskell identifier can start with it)? Maybe .line or -line ? AFAICS, I think line- should do. From w3.org: ID and NAME tokens must begin with a letter

Re: [Haskell-cafe] Is take behaving correctly?

2007-09-12 Thread Henning Thielemann
On Wed, 12 Sep 2007, Conor McBride wrote: Hi folks On 12 Sep 2007, at 00:38, Brent Yorgey wrote: On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote: Hi take 1000 [1..3] still yields [1,2,3] I thought it was supposed to return an error. [..] If for some reason you want a version that does

Re: [Haskell-cafe] Haskell and State Monad.

2007-09-12 Thread david48
On 9/12/07, VinyleEm [EMAIL PROTECTED] wrote: projects there, some of them being incomplete. Could you please suggest me some project, from which i can learn the State Monad. xmonad perhaps ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Andrea Rossato
Hi, supposed that, in a Linux system, in an utf-8 locale, you create a file with non ascii characters. For instance: touch abèèè Now, I would expect that the output of a shell command such as ls ab* would be a string/list of 5 chars. Instead I find it to be a list of 8 chars...;-) That is to

[Haskell-cafe] Re: getting crazy with character encoding

2007-09-12 Thread Stephane Bortzmeyer
On Wed, Sep 12, 2007 at 04:18:43PM +0200, Andrea Rossato [EMAIL PROTECTED] wrote a message of 60 lines which said: Now, I would expect that the output of a shell command such as ls ab* would be a string/list of 5 chars. I do not think this expectation is reasonable. I do not think that

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Brandon S. Allbery KF8NH
On Sep 12, 2007, at 10:18 , Andrea Rossato wrote: supposed that, in a Linux system, in an utf-8 locale, you create a file with non ascii characters. For instance: touch abèèè Now, I would expect that the output of a shell command such as ls ab* would be a string/list of 5 chars. Instead I

Re: [Haskell-cafe] Haskell and State Monad.

2007-09-12 Thread Jules Bean
VinyleEm wrote: Hello all, I am Vinay Emani, new to this forum. I am doing an academic project of writing an assembler cum linker in Haskell as part of building a compiler set written entirely in Haskell. Since i am new to the language, i thought it would do me good to look at some of the

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Seth Gordon
Andrea Rossato wrote: Hi, supposed that, in a Linux system, in an utf-8 locale, you create a file with non ascii characters. For instance: touch abèèè Now, I would expect that the output of a shell command such as ls ab* would be a string/list of 5 chars. Instead I find it to be a list of 8

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Andrea Rossato
On Wed, Sep 12, 2007 at 10:53:29AM -0400, Brandon S. Allbery KF8NH wrote: That is expected. The low level filesystem storage doesn't know about character sets, so non-ASCII filenames must be encoded in e.g. UTF-8. 8 characters is therefore correct, and you must do UTF-8 decoding on input

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Dougal Stanton
On 12/09/2007, Seth Gordon [EMAIL PROTECTED] wrote: I � Unicode. Was it intentional that the central character appears as a little '?', even though the aleph on the line above worked? Either way it would be very amusing, but for different reasons... D

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Andrea Rossato
On Wed, Sep 12, 2007 at 11:16:25AM -0400, Seth Gordon wrote: It appears that in spite of the locale definition, hGetContents is treating each byte as a separate character without translating the multi-byte sequences *from* UTF-8, and then putStrLn sends each of those bytes to standard

[Haskell-cafe] Re: getting crazy with character encoding

2007-09-12 Thread Andrea Rossato
On Wed, Sep 12, 2007 at 04:35:50PM +0200, Stephane Bortzmeyer wrote: This is not an Haskell issue but a ls issue. use System.Directory.getDirectoryContents and we'll see. I get the very same output. Thanks for you kind attention. Andrea ___

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Seth Gordon
Andrea Rossato wrote: What puzzles me is the behavior of putStrLn. putStrLn is sending the following bytes to standard output: 97, 98, 195, 168, 195, 168, 195, 168, 10 Since the code that renders characters in your terminal emulator is expecting UTF-8[*], each (195, 168) pair of bytes is

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Conor McBride
Hi On 12 Sep 2007, at 11:44, ChrisK wrote: Conor McBride wrote: I'd like operations to complain about bogus input, rather than producing bogus output. Then you want a runtime assertion checking error helpful Data.List replacement. Could you use Control.Exception.assert and make a

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Seth Gordon
Dougal Stanton wrote: On 12/09/2007, Seth Gordon [EMAIL PROTECTED] wrote: I � Unicode. Was it intentional that the central character appears as a little '?', even though the aleph on the line above worked? It was intentional. If I ♡ed Unicode, I would have said so.

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Neil Mitchell
Hi A more serious point is that in some cases we might want take to underapproximate, or zip to truncate (or tail [] = [] ?). I don't think there's always a clear library choice here. I have a zipWithEq function I often use, which crashes if the zip'd lists aren't equal. I also have tailSafe

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread PR Stanley
I quite like the argument that take is a total function and as such all its return values are from teh specificed range. I can also see the logic in take n [] = [] where n 0 taking n from nothing, or the empty set, returns nothing! The same should apply to head and tail. head or tail of []

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Neil Mitchell
Hi The same should apply to head and tail. head or tail of [] should be []. What does the list think? Disagree, strongly. Its not even possible for head, since [a] - a. Wadler's theorems for free states that if head is given an empty list the _only_ thing it can do is crash. Thanks Neil

[Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Henning Thielemann
On Wed, 12 Sep 2007, PR Stanley wrote: I quite like the argument that take is a total function and as such all its return values are from teh specificed range. I can also see the logic in take n [] = [] where n 0 taking n from nothing, or the empty set, returns nothing! The same should apply

[Haskell-cafe] Re: Functional dependencies conflict between instance declarations

2007-09-12 Thread Stefan Monnier
Never mind, that GHC compiler was again more clever than me, sigh. That's really frustrating about Haskell: the compiler captures so many errors at compile time, that newbies hardly get anything done, it's a constant battle against the errors. But once it compiles, it usually works at runtime

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Andrea Rossato
On Wed, Sep 12, 2007 at 11:40:11AM -0400, Seth Gordon wrote: The Unix utility od can be very helpful in figuring out problems like this. Thanks for pointing me to od, I didn't know it. [*]At least on my computer, I get the same result *even if* I change LANG from en_US.utf8 to C. As

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Dan Piponi
On 9/12/07, PR Stanley [EMAIL PROTECTED] wrote: The same should apply to head and tail. head or tail of [] should be Disagree, strongly. Its not even possible for head, What's the logic behind this? You don't need anything sophisticated for this. What possible total function could have

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Andrew Coppin
PR Stanley wrote: Hi The same should apply to head and tail. head or tail of [] should be []. What does the list think? Disagree, strongly. Its not even possible for head, since [a] - a. Wadler's theorems for free states that if head is given an empty list the _only_ thing it can do is

Re: [Haskell-cafe] Haskell and State Monad.

2007-09-12 Thread Paul Johnson
VinyleEm wrote: In particular i need to find some project/program which extensively uses the State Monad. Perhaps you could tell us why you think you need the State Monad? It may be that there are easier ways of dealing with this. For an assembler you need to build up a symbol table

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread David Benbennick
On 9/12/07, Andrea Rossato [EMAIL PROTECTED] wrote: If I run it in a console I get abAAA (sort of) no matter what my LANG is - 8 single 8 -bit characters. It's possible to set your Linux console to grok UTF8. I don't remember the details, but I'm sure you can Google for it. By the way, does

RE: [Haskell-cafe] Re: Functional dependencies conflict between instance declarations

2007-09-12 Thread bf3
Are you kidding, or has automatic proving of programs evolved that far? Anyway, for my sector, videogames, proving if something works correctly is subjective, it's very hard to check if the gameplay of a game is good enough since that involves human fuzzy judgement ;-) Although this might just

Re: [Haskell-cafe] Re: Functional dependencies conflict between instance declarations

2007-09-12 Thread Andrew Coppin
[EMAIL PROTECTED] wrote: Are you kidding, or has automatic proving of programs evolved that far? Aaarrrggg, soon we're all out of job ;-) Experts have been proclaiming this since high-level programming was invented many decades ago. We're still waiting. ;-)

Re: [Haskell-cafe] Basic FFI with GHC

2007-09-12 Thread Ronald Guida
Ronald Guida wrote: How do I create C-libraries that I can load into GHCi? I am trying to do some basic FFI, and it's not working. So, after more searching on the internet and some RTFM, I think I found my answer, and it seems to work, but I don't know if it's the right answer to generalize

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Jules Bean
David Benbennick wrote: On 9/12/07, Andrea Rossato [EMAIL PROTECTED] wrote: If I run it in a console I get abAAA (sort of) no matter what my LANG is - 8 single 8 -bit characters. It's possible to set your Linux console to grok UTF8. I don't remember the details, but I'm sure you can Google

Re: [Haskell-cafe] Is take behaving correctly?

2007-09-12 Thread Dan Weston
One idiom I rely on pretty often is (id tail) uncurry (zipWith f) to do pairwise binary operations (though I suspect an Applicative functor might be a better way to go?). E.g. my solution for ProjectEuler problem #18 (max sum of vertical path through a triangle of integers) is: f =

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Don Stewart
mailing_list: On Wed, Sep 12, 2007 at 11:16:25AM -0400, Seth Gordon wrote: It appears that in spite of the locale definition, hGetContents is treating each byte as a separate character without translating the multi-byte sequences *from* UTF-8, and then putStrLn sends each of those

[Haskell-cafe] help getting happy

2007-09-12 Thread Greg Meredith
Haskellians, The code pasted in below causes Happy to return parE when invoked with happy rparse.y -i . Is there anyway to get Happy to give me just a wee bit more info as to what might be causing the parE (which i interpret a 'parse error'). Best wishes, --greg { module Main where } %name

Re: [Haskell-cafe] Haskell and State Monad.

2007-09-12 Thread Don Stewart
dav.vire+haskell: On 9/12/07, VinyleEm [EMAIL PROTECTED] wrote: projects there, some of them being incomplete. Could you please suggest me some project, from which i can learn the State Monad. xmonad perhaps ? Yes, I think xmonad is a good example of the standard Haskell approach to

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-12 Thread Don Stewart
bf3: Thanks for all the info. It's really good news that code coverage is now part of the GHC compiler! Any more info on that deep seq? I can't find it in the libraries that come with GHC 6.6.1. It seems to be part of Control.Strategies.DeepSeq of HXT. This is a separate download?

Re[2]: [Haskell-cafe] Basic FFI with GHC

2007-09-12 Thread Bulat Ziganshin
Hello Ronald, Wednesday, September 12, 2007, 11:18:05 PM, you wrote: So, after more searching on the internet and some RTFM, I think I found my answer, and it seems to work, but I don't know if it's the right answer to generalize from. i have added your recipe to

[Haskell-cafe] Monad.Reader 8: Haskell, the new C++

2007-09-12 Thread ok
In Monad.Reader 8, Conrad Parker shows how to solve the Instant Insanity puzzle in the Haskell type system. Along the way he demonstrates very clearly something that was implicit in Mark Jones' Type Classes with Functional Dependencies paper if you read it very very carefully (which I hadn't,

Re: [Haskell-cafe] Monad.Reader 8: Haskell, the new C++

2007-09-12 Thread Albert Y. C. Lai
ok wrote: So we have C++ : imperative language whose type system is a Turing-complete functional language (with rather twisted syntax) Haskell: functional language whose type system is a Turing- complete logic programming language (with rather twisted

Re: [Haskell-cafe] Monad.Reader 8: Haskell, the new C++

2007-09-12 Thread Don Stewart
ok: In Monad.Reader 8, Conrad Parker shows how to solve the Instant Insanity puzzle in the Haskell type system. Along the way he demonstrates very clearly something that was implicit in Mark Jones' Type Classes with Functional Dependencies paper if you read it very very carefully (which I

Re: [Haskell-cafe] Is take behaving correctly?

2007-09-12 Thread ok
On 12 Sep 2007, at 8:08 pm, [EMAIL PROTECTED] wrote: take 1000 [1..3] still yields [1,2,3] You can think about take n as: Take as much as possible, but at most n elements. This behavior has some nice properties as turned out by others, but there are some pitfalls. One of the very nice

[Haskell-cafe] Re: Monad.Reader 8: Haskell, the new C++

2007-09-12 Thread Aaron Denney
On 2007-09-12, Don Stewart [EMAIL PROTECTED] wrote: ok: I've been told that functional dependencies are old hat and there is now something better. I suspect that better here means worse. Better here means better -- a functional language on the type system, to type a functional language on

Re: [Haskell-cafe] Re: Monad.Reader 8: Haskell, the new C++

2007-09-12 Thread Derek Elkins
On Wed, 2007-09-12 at 23:36 +, Aaron Denney wrote: On 2007-09-12, Don Stewart [EMAIL PROTECTED] wrote: ok: I've been told that functional dependencies are old hat and there is now something better. I suspect that better here means worse. Better here means better -- a functional

[Haskell-cafe] Re: getting crazy with character encoding

2007-09-12 Thread Aaron Denney
Hi. I believe that everything I've said has been said by another responder, but not all together in one place. On 2007-09-12, Andrea Rossato [EMAIL PROTECTED] wrote: supposed that, in a Linux system, in an utf-8 locale, you create a file with non ascii characters. For instance: touch abèèè

Re: [Haskell-cafe] Re: getting crazy with character encoding

2007-09-12 Thread Stefan O'Rear
On Thu, Sep 13, 2007 at 12:23:33AM +, Aaron Denney wrote: Unfortunately, at this point it is a well entrenched bug, and changing the behaviour will undoubtedly break programs. ... There should be another system for getting the exact bytes in and out (as Word8s, say, rather than Chars), and

Re: [Haskell-cafe] Monad.Reader 8: Haskell, the new C++

2007-09-12 Thread Stefan Holdermans
C++ : imperative language whose type system is a Turing-complete functional language (with rather twisted syntax) Haskell: functional language whose type system is a Turing- complete logic programming language (with rather twisted syntax)