Re: [Haskell-cafe] Re: Monad for HOAS?

2008-05-14 Thread Edsko de Vries
On Wed, May 14, 2008 at 06:01:37PM -0400, Chung-chieh Shan wrote: > Conal Elliott <[EMAIL PROTECTED]> wrote in article <[EMAIL PROTECTED]> in > gmane.comp.lang.haskell.cafe: > > I share your perspective, Edsko. If foo and (Let foo id) are > > indistinguishable to clients of your module and are eq

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Bill
On Wed, 2008-05-14 at 20:59 +0200, Henning Thielemann wrote: . . . > Interesting to know what jokes are told about Germans. 8-] So, do English > professors save their prepositions for the end of a lecture? This seems peculiarly apropos: I lately lost a preposition. It hid, I thought, b

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 22:57, Derek Elkins wrote: On Thu, 2008-05-15 at 14:40 +1200, Richard A. O'Keefe wrote: I suspect that "λ is the lambda-symbol iff it is not preceded by any identifier character and is not followed by a Greek letter" might work. λω. ... λα. ... λδ ε. ... Come to think

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Albert Y. C. Lai
Claus Reinke wrote: Germans have no problems with sentences which though started at the beginning when observed closely and in the light of day (none of which adds anything to the content of the sentence in which the very parenthetical remark you -dear reader- are reading at this very moment whil

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Derek Elkins
On Thu, 2008-05-15 at 14:40 +1200, Richard A. O'Keefe wrote: > On 15 May 2008, at 2:34 pm, Brandon S. Allbery KF8NH wrote: > > Hm. Newer Unicode standard than the version supported by OSX and > > GNOME, I take it? That's not so helpful if nobody actually supports > > the characters in questio

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 22:40, Richard A. O'Keefe wrote: I still suspect it would not be outside the pale to make λ a keyword. We already have several, after all. I'd rather not have to write \x as λ x with a space required after the λ. I suspect that "λ is the lambda-symbol iff it is not pre

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Richard A. O'Keefe
On 15 May 2008, at 2:34 pm, Brandon S. Allbery KF8NH wrote: Hm. Newer Unicode standard than the version supported by OSX and GNOME, I take it? That's not so helpful if nobody actually supports the characters in question. (My Mac claims 166CC is in an unassigned area, and no supplied font

Re: [Haskell-cafe] Re: Richer (than ascii) notation for haskell source?

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 22:23, Patrick Surry wrote: So maybe what I really want is to essentially write my source in (la)tex and be able to both compile and render to dvi at the same time? I suppose word's crazy equation editor or mathml is another option but it makes the source itself either

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 22:07, Richard A. O'Keefe wrote: On 15 May 2008, at 7:19 am, Brandon S. Allbery KF8NH wrote: Unfortunately, while I thought there was a distinct lambda sign that wasn't the lowercase Greek letter, there isn't. (That said, I don't see why it couldn't be a keyword. You'd

[Haskell-cafe] RE: Richer (than ascii) notation for haskell source?

2008-05-14 Thread Patrick Surry
Sorry, missed a mail digest: LyX and lhs2tex sound more like what I mean. Patrick -Original Message- From: Patrick Surry Sent: Wednesday, May 14, 2008 10:24 PM To: 'haskell-cafe@haskell.org' Subject: Re: Richer (than ascii) notation for haskell source? Lots of folk have suggested writin

[Haskell-cafe] Re: Richer (than ascii) notation for haskell source?

2008-05-14 Thread Patrick Surry
Lots of folk have suggested writing code with Unicode symbols, but that doesn't really get me where I'm thinking of. Back in the day, I spent many happy hours writing math(s) in amstex style, peppered with latex backslash references/macros for greek symbols, set operators as well as character attr

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Dan Weston
Richard A. O'Keefe wrote: At least to give editors a fighting chance of matching their concept of a "word" with Haskell tokens, it might be better to use nabla instead of lambda. Other old APL fans may understand why (:-). Alternatively, didn't Church really want to use a character rather like

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Richard A. O'Keefe
On 15 May 2008, at 7:19 am, Brandon S. Allbery KF8NH wrote: Unfortunately, while I thought there was a distinct lambda sign that wasn't the lowercase Greek letter, there isn't. (That said, I don't see why it couldn't be a keyword. You'd need a space after it.) There are three lambda letter

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Eric Stansifer
> So I've always wondered, if you are writing down a number being dictated > (slowly) by someone else, like 234, do you write the 2, then leave space and > write the 4, then go back and fill in with 3? Or do you push the 4 onto the > stack until the 3 arrives, and write 34 at once. My German profe

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Jonathan Cast
On 14 May 2008, at 2:13 PM, Claus Reinke wrote: It's not that simple with bits. They lack consistency just like the usual US date format and the way Germans read numbers. So you claim that you pronounce 14 tenty-four? In German pronunciation is completely uniform from 13 to 99. http://w

Re: [Haskell-cafe] Re: GHC predictability

2008-05-14 Thread Don Stewart
derek.a.elkins: > On Mon, 2008-05-12 at 19:30 -0700, Don Stewart wrote: > > > I offer up the following example: > > > > > > mean xs = sum xs / length xs > > > > > > Now try, say, "mean [1.. 1e9]", and watch GHC eat several GB of RAM. (!!) > > > > But you know why, don't you? > > > > > sat down

Re: [Haskell-cafe] Re: GHC predictability

2008-05-14 Thread Derek Elkins
On Mon, 2008-05-12 at 19:30 -0700, Don Stewart wrote: > > I offer up the following example: > > > > mean xs = sum xs / length xs > > > > Now try, say, "mean [1.. 1e9]", and watch GHC eat several GB of RAM. (!!) > > But you know why, don't you? > > > sat down and spent the best part of a day wri

Re: [Haskell-cafe] GHC API GSoc project (was: ANN: Haddock version 2.1.0)

2008-05-14 Thread Chaddaï Fouché
2008/5/15 Claus Reinke <[EMAIL PROTECTED]>: > Feel free to CC me or the ticket with things like that. I'll be > IMHO, trying to support a semantics- and comment-preserving > roundtrip in (pretty . parse) would be a good way to start (David > says he's going to look at the extracting comments/p

Re: [Haskell-cafe] Monad vs ArrowChoice

2008-05-14 Thread Twan van Laarhoven
Ronald Guida wrote: I have read that Monad is stronger than Idiom because Monad lets me use the results of a computation to choose between the side effects of alternative future computations, while Idiom does not have this feature. Arrow does not have this feature either. ArrowChoice has the fe

Re: [Haskell-cafe] Short circuiting and the Maybe monad

2008-05-14 Thread Derek Elkins
On Wed, 2008-05-14 at 12:42 -0700, Dan Piponi wrote: > On Wed, May 14, 2008 at 12:03 PM, Andrew Coppin > <[EMAIL PROTECTED]> wrote: > > > "It is well-known that trees with substitution form a monad." > > Now that's funny. Compare with the first line of this paper: > http://citeseer.ist.psu.edu/51

Re: [Haskell-cafe] FFI: newbie linking problem

2008-05-14 Thread Olivier Boudry
On Wed, May 14, 2008 at 5:46 PM, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > use stdcall instead of ccall in Haskell too. afair, depending on > calling conventions, different prefixes/suffixes are used when > translating C function name into assembler (dll) name > Oops, sorry I copied the wrong

[Haskell-cafe] Re: Monad for HOAS?

2008-05-14 Thread Chung-chieh Shan
Conal Elliott <[EMAIL PROTECTED]> wrote in article <[EMAIL PROTECTED]> in gmane.comp.lang.haskell.cafe: > I share your perspective, Edsko. If foo and (Let foo id) are > indistinguishable to clients of your module and are equal with respect to > your intended semantics of Exp, then I'd say at leas

[Haskell-cafe] Monad vs ArrowChoice

2008-05-14 Thread Ronald Guida
I have read that Monad is stronger than Idiom because Monad lets me use the results of a computation to choose between the side effects of alternative future computations, while Idiom does not have this feature. Arrow does not have this feature either. ArrowChoice has the feature that the sum typ

[Haskell-cafe] GHC API GSoc project (was: ANN: Haddock version 2.1.0)

2008-05-14 Thread Claus Reinke
Feel free to CC me or the ticket with things like that. I'll be working on this for this year's GSoC and it'd be helpful to find out what I should tackle first. Hi Thomas, thanks, I was wondering about your project. Is there a project page documenting the issues/tickets you look at, and partic

Re: [Haskell-cafe] FFI: newbie linking problem

2008-05-14 Thread Bulat Ziganshin
Hello Olivier, Thursday, May 15, 2008, 1:26:28 AM, you wrote: >     RFC_RC _stdcall RfcUTF8ToSAPUC(const RFC_BYTE *utf8, unsigned > utf8Length,  SAP_UC *sapuc, >   unsigned *sapucSize, unsigned *resultLength, RFC_ERROR_INFO *info) >     foreign import ccall unsafe "sapnwrfc.h RfcUTF8ToSAPUC

Re: [Haskell-cafe] Copy on read

2008-05-14 Thread Stefan Holdermans
Dan, Let me first apologize for this late reply. Neil pointed you to Jurriaan Hage and Stefan Holdermans. Heap recycling for lazy languages. In John Hatcliff, Robert Glück, and Oege de Moor, editors, _Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Progr

[Haskell-cafe] FFI: newbie linking problem

2008-05-14 Thread Olivier Boudry
Hi all, I'm trying to call the following C function. RFC_RC _stdcall RfcUTF8ToSAPUC(const RFC_BYTE *utf8, unsigned utf8Length, SAP_UC *sapuc, unsigned *sapucSize, unsigned *resultLength, RFC_ERROR_INFO *info) I wrote a foreign import for this function: foreign import ccall unsafe

Re: [Haskell-cafe] Data.Dynamic over the wire

2008-05-14 Thread Gökhan San
Hi, > {-# LANGUAGE ExistentialQuantification, ScopedTypeVariables #-} Following the related discussion on #haskell, I ended up writing the below code (thanks to the suggestions). This is for a genetic programming library, but the usage would be similar. It also (de)serializes TypeRep. I'm a has

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Claus Reinke
It's not that simple with bits. They lack consistency just like the usual US date format and the way Germans read numbers. So you claim that you pronounce 14 tenty-four? In German pronunciation is completely uniform from 13 to 99. http://www.verein-zwanzigeins.de/ So I've always wondered, i

[Haskell-cafe] Re: Endianess

2008-05-14 Thread Achim Schneider
Henning Thielemann <[EMAIL PROTECTED]> wrote: > Of course, we write down 243, realize the mistake and rewrite the > number. :-) Actually, many pupils have problems with the mixed order > of digits and give solutions like this one in examinations: >8 * 8 = 46 > because they write the digits a

Re[2]: [Haskell-cafe] Fun with Darcs

2008-05-14 Thread Bulat Ziganshin
Hello Andrew, Thursday, May 15, 2008, 12:49:32 AM, you wrote: > touch. Now, let's see what this IDE actually looks li-- oh you have GOT > to be KIDDING me! It can't find the right GTK DLL?!? gtk2hs includes *developer* gtk2 environment. while it should work fine (as far as it's in your path), yo

Re: [Haskell-cafe] Fun with Darcs

2008-05-14 Thread Andrew Coppin
David Roundy wrote: On Wed, May 14, 2008 at 08:37:53PM +0100, Andrew Coppin wrote: Andrew Coppin wrote: I've recently reinstalled Windows, so I decided to go download the latest Darcs and set that up. Now it's complaining that I don't have curl or wget. (Never used to do that before.)

Re: [Haskell-cafe] Fun with Darcs

2008-05-14 Thread David Roundy
On Wed, May 14, 2008 at 08:37:53PM +0100, Andrew Coppin wrote: > Andrew Coppin wrote: > >Henning Thielemann wrote: > >> > >>As said, the IDE Leksah can display code exactly like this ... > >> > > > >I noticed the first time. Clearly this is another toy I'm going to > >have to try out sometime... >

Re: [Haskell-cafe] Short circuiting and the Maybe monad

2008-05-14 Thread Dan Piponi
On Wed, May 14, 2008 at 12:03 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > "It is well-known that trees with substitution form a monad." Now that's funny. Compare with the first line of this paper: http://citeseer.ist.psu.edu/510658.html Anyway, I worked through an elementary example of this w

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 15:00, Andrew Coppin wrote: Brandon S. Allbery KF8NH wrote: On 2008 May 14, at 14:32, Andrew Coppin wrote: Personally, I'd just like to be able to get rid of "->", "\" and other such hacks. Would it be possible to amend GHC so that it accepts "->" and [whatever the Unico

[Haskell-cafe] Fun with Darcs

2008-05-14 Thread Andrew Coppin
Andrew Coppin wrote: Henning Thielemann wrote: As said, the IDE Leksah can display code exactly like this ... I noticed the first time. Clearly this is another toy I'm going to have to try out sometime... ...and then he discovers that Darcs isn't working any more. :-( I've recently reins

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 15:00, Andrew Coppin wrote: Brandon S. Allbery KF8NH wrote: On 2008 May 14, at 14:32, Andrew Coppin wrote: Personally, I'd just like to be able to get rid of "->", "\" and other such hacks. Would it be possible to amend GHC so that it accepts "->" and [whatever the Uni

Re: [Haskell-cafe] Using Template Haskell to make type-safe database access

2008-05-14 Thread Mads Lindstrøm
Hi Bjorn Bringert wrote: > Mads: Preparing the statement and asking the DB about the type at > compile is a great idea! I've never thought of that. Please consider > completing this and packaging it as a library. Thanks for the nice remark. And I will begin completing the idea, as soon I have pa

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Andrew Coppin
Henning Thielemann wrote: On Wed, 14 May 2008, Andrew Coppin wrote: Personally, I'd just like to be able to get rid of "->", "\" and other such hacks. Would it be possible to amend GHC so that it accepts "->" and [whatever the Unicode codepoint for "left arrow" is] and treats both the same?

Re: [Haskell-cafe] Short circuiting and the Maybe monad

2008-05-14 Thread Andrew Coppin
Janis Voigtlaender wrote: http://wwwtcs.inf.tu-dresden.de/~voigt/mpc08.pdf "It is well-known that trees with substitution form a monad." ...OK, I just learned something new. Hanging around Haskell Cafe can be so illuminating! :-) Now, if only I could actually comprehend the rest of the pape

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Henning Thielemann
On Wed, 14 May 2008, Andrew Coppin wrote: Personally, I'd just like to be able to get rid of "->", "\" and other such hacks. Would it be possible to amend GHC so that it accepts "->" and [whatever the Unicode codepoint for "left arrow" is] and treats both the same? As said, the IDE Leksah c

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Andrew Coppin
Brandon S. Allbery KF8NH wrote: On 2008 May 14, at 14:32, Andrew Coppin wrote: Personally, I'd just like to be able to get rid of "->", "\" and other such hacks. Would it be possible to amend GHC so that it accepts "->" and [whatever the Unicode codepoint for "left arrow" is] and treats both

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Henning Thielemann
On Wed, 14 May 2008, Brandon S. Allbery KF8NH wrote: On 2008 May 14, at 14:34, Dan Weston wrote: So I've always wondered, if you are writing down a number being dictated (slowly) by someone else, like 234, do you write the 2, then leave space and write the 4, then go back and fill in with 3

[Haskell-cafe] Re: Endianess

2008-05-14 Thread Henning Thielemann
On Wed, 14 May 2008, Dan Weston wrote: Henning Thielemann wrote: http://www.verein-zwanzigeins.de/ So I've always wondered, if you are writing down a number being dictated (slowly) by someone else, like 234, do you write the 2, then leave space and write the 4, then go back and fill in wi

Re: [Haskell-cafe] Two-iteration optimisation (was: GHC Predictability)

2008-05-14 Thread Andrew Coppin
Albert Y. C. Lai wrote: If you worry that the sum thread and the length thread are not synchronized and therefore there is still no bound on the list prefix kept in memory, I'm sure you can improve it by one of the chunking strategies. I'm more worried that data now has to go through tiny CPU

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Andrew Coppin
Reinier Lamers wrote: Op 14-mei-2008, om 20:32 heeft Andrew Coppin het volgende geschreven: Personally, I'd just like to be able to get rid of "->", "\" and other such hacks. Would it be possible to amend GHC so that it accepts "->" and [whatever the Unicode codepoint for "left arrow" is] and

Re: [Haskell-cafe] Two-iteration optimisation (was: GHC Predictability)

2008-05-14 Thread Albert Y. C. Lai
Paul Johnson wrote: The solution is for the programmer to rewrite "mean" to accumulate a pair containing the running total and count together, then do the division. This makes me wonder: could there be a compiler optimisation rule for this, collapsing two iterations over a list into one. Do

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 14:34, Dan Weston wrote: So I've always wondered, if you are writing down a number being dictated (slowly) by someone else, like 234, do you write the 2, then leave space and write the 4, then go back and fill in with 3? Or do you push the 4 onto the stack until the 3 ar

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 14:32, Andrew Coppin wrote: Personally, I'd just like to be able to get rid of "->", "\" and other such hacks. Would it be possible to amend GHC so that it accepts "->" and [whatever the Unicode codepoint for "left arrow" is] and treats both the same? Both of those ar

Re: [Haskell-cafe] Two-iteration optimisation

2008-05-14 Thread Andrew Coppin
Don Stewart wrote: You'd want a general fusion framework for this, and other accumulators, that's let's you treat 'f' as a zip of some kind that pulls items from its two arguments. And then require only a single rewrite rule for all your loop forms. Stream fusion (see "Lists to Streams to Nothin

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Dan Weston
Henning Thielemann wrote: On Tue, 13 May 2008, Achim Schneider wrote: Jed Brown <[EMAIL PROTECTED]> wrote: It's not that simple with bits. They lack consistency just like the usual US date format and the way Germans read numbers. So you claim that you pronounce 14 tenty-four? In German pr

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Andrew Coppin
Patrick Surry wrote: Probably a silly question, but for me one of the nice things about Haskell is that it's a lot like just writing math(s). But in contrast to math you lose a lot of notational flexibility being limited to the ascii character set in your source code. It would be nice to be

Re: [Haskell-cafe] Re: GHC predictability

2008-05-14 Thread Brandon S. Allbery KF8NH
On 2008 May 14, at 14:23, Andrew Coppin wrote: Neil Mitchell wrote: 1. What is "ghc-core"? You actually answer this question as part of question 2. Think of it as simple Haskell with some additional bits. I rephrase: I know what GHC's Core language is. But Dons said "I suggest you insta

Re: [Haskell-cafe] Re: GHC predictability

2008-05-14 Thread Andrew Coppin
Richard A. O'Keefe wrote: On 14 May 2008, at 8:58 am, Andrew Coppin wrote: What I'm trying to say [and saying very badly] is that Haskell is an almost terrifyingly subtle language. Name me a useful programming language that isn't. Simply interchanging two for-loops, from for (i = 0; i < N

Re: [Haskell-cafe] GHC predictability

2008-05-14 Thread Don Stewart
andrewcoppin: > Brandon S. Allbery KF8NH wrote: > > > >On 2008 May 13, at 17:01, Andrew Coppin wrote: > > > >>That definition of mean is wrong because it traverses the list twice. > >>(Curiosity: would traversing it twice in parallel work any better?) > >>As for the folds - I always *always* mix

Re: [Haskell-cafe] Endianess

2008-05-14 Thread Andrew Coppin
Brandon S. Allbery KF8NH wrote: On 2008 May 13, at 17:12, Andrew Coppin wrote: [Oh GOD I hope I didn't just start a Holy War...] Er, I'd say it's already well in progress. :/ Oh dear. Appologies to everybody who doesn't actually _care_ about which endian mode their computer uses...

Re: [Haskell-cafe] GHC predictability

2008-05-14 Thread Andrew Coppin
Brandon S. Allbery KF8NH wrote: On 2008 May 13, at 17:01, Andrew Coppin wrote: That definition of mean is wrong because it traverses the list twice. (Curiosity: would traversing it twice in parallel work any better?) As for the folds - I always *always* mix up It might work "better" but you

Re: [Haskell-cafe] Re: GHC predictability

2008-05-14 Thread Andrew Coppin
Neil Mitchell wrote: Hi 1. What is "ghc-core"? You actually answer this question as part of question 2. Think of it as simple Haskell with some additional bits. I rephrase: I know what GHC's Core language is. But Dons said "I suggest you install ghc-core", which suggests the ex

Re: [Haskell-cafe] Re: GHC predictability

2008-05-14 Thread Andrew Coppin
Don Stewart wrote: ndmitchell: 2. Does anybody know how to actually read GHC's Core output anyway? There is one different from standard Haskell I am aware of. In Core, case x of _ -> 1 will evaluate x, in Haskell it won't. Other than that, its just Haskell, but without pattern matchi

Re: [Haskell-cafe] Commutative monads vs Applicative functors

2008-05-14 Thread Ronald Guida
David Menendez wrote: > To summarize: some applicative functors are commutative, some > applicative functors are monads, and the ones that are both are > commutative monads. OK, so commutativity is orthogonal to "idiom vs monad". Commutativity depends on whether or not the order of side effects i

Re: [Haskell-cafe] Two-iteration optimisation (was: GHC Predictability)

2008-05-14 Thread Henning Thielemann
On Wed, 14 May 2008, Paul Johnson wrote: We've had a big debate over mean xs = foldl' (+) 0 xs / fromIntegral (length xs) For anyone who didn't follow it, the problem is that "mean" needs to traverse its argument twice, so the entire list has to be held in memory. So if "xs = [1..100

Re: [Haskell-cafe] Two-iteration optimisation (was: GHC Predictability)

2008-05-14 Thread Don Stewart
paul: > We've had a big debate over > > > mean xs = foldl' (+) 0 xs / fromIntegral (length xs) > > For anyone who didn't follow it, the problem is that "mean" needs to > traverse its argument twice, so the entire list has to be held in > memory. So if "xs = [1..10]" then "mean xs" uses

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Reinier Lamers
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Op 14-mei-2008, om 15:43 heeft Patrick Surry het volgende geschreven: It would be nice to be able to use a richer set of symbols in your source code for operators and functions (e.g. integral, sum, dot and cross-product, …), as well as variables

[Haskell-cafe] Two-iteration optimisation (was: GHC Predictability)

2008-05-14 Thread Paul Johnson
We've had a big debate over > mean xs = foldl' (+) 0 xs / fromIntegral (length xs) For anyone who didn't follow it, the problem is that "mean" needs to traverse its argument twice, so the entire list has to be held in memory. So if "xs = [1..10]" then "mean xs" uses all your memory,

Re: [Haskell-cafe] Commutative monads vs Applicative functors

2008-05-14 Thread David Menendez
On Tue, May 13, 2008 at 9:06 PM, Ronald Guida <[EMAIL PROTECTED]> wrote: > I have a few questions about commutative monads and applicative functors. > > >From what I have read about applicative functors, they are weaker than > monads because with a monad, I can use the results of a computation to

Re: [Haskell-cafe] Monad for HOAS?

2008-05-14 Thread Conal Elliott
I share your perspective, Edsko. If foo and (Let foo id) are indistinguishable to clients of your module and are equal with respect to your intended semantics of Exp, then I'd say at least this one monad law holds. - Conal On Wed, May 14, 2008 at 7:59 AM, Edsko de Vries <[EMAIL PROTECTED]> wrote

Re: [Haskell-cafe] printing a list of directories which don't exist

2008-05-14 Thread Daniel Fischer
Am Mittwoch, 14. Mai 2008 17:47 schrieb Mike Jarmy: > Newbie question: Given a list of type '[FilePath]', how do I create a list > of all those directories which do not actually exist, and then print the > list? I've figured out how to extract the ones which *do* exist, like so: > > module Main w

Re: [Haskell-cafe] printing a list of directories which don't exist

2008-05-14 Thread Henning Thielemann
On Wed, 14 May 2008, Mike Jarmy wrote: Newbie question: Given a list of type '[FilePath]', how do I create a list of all those directories which do not actually exist, and then print the list? I've figured out how to extract the ones which *do* exist, like so: module Main where import Contr

[Haskell-cafe] printing a list of directories which don't exist

2008-05-14 Thread Mike Jarmy
Newbie question: Given a list of type '[FilePath]', how do I create a list of all those directories which do not actually exist, and then print the list? I've figured out how to extract the ones which *do* exist, like so: module Main where import Control.Monad (filterM) import System.Directory

[Haskell-cafe] Re: Endianess

2008-05-14 Thread Achim Schneider
Henning Thielemann <[EMAIL PROTECTED]> wrote: > > On Tue, 13 May 2008, Achim Schneider wrote: > > > Jed Brown <[EMAIL PROTECTED]> wrote: > > > >> It's not that simple with bits. They lack consistency just like > >> the usual US date format and the way Germans read numbers. > >> > > So you claim

Re: [Haskell-cafe] Monad for HOAS?

2008-05-14 Thread Lauri Alanko
On Wed, May 14, 2008 at 03:59:23PM +0100, Edsko de Vries wrote: > You mention that a "direct" implementation of what I suggested would > break the monad laws, as (foo) and (Let foo id) are not equal. But one > might argue that they are in fact, in a sense, equivalent. Do you reckon > that if it is

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Henning Thielemann
On Wed, 14 May 2008, Patrick Surry wrote: Probably a silly question, but for me one of the nice things about Haskell is that it's a lot like just writing math(s). But in contrast to math you lose a lot of notational flexibility being limited to the ascii character set in your source code. Le

Re: [Haskell-cafe] Monad for HOAS?

2008-05-14 Thread Edsko de Vries
Hi, On Wed, May 14, 2008 at 03:59:58PM +0300, Lauri Alanko wrote: > On Wed, May 14, 2008 at 10:11:17AM +0100, Edsko de Vries wrote: > > Suppose we have some data structure that uses HOAS; typically, a DSL > > with explicit sharing. For example: > > > > > data Expr = One | Add Expr Expr | Let Expr

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Neil Mitchell
Hi > It would be nice to be able to use a richer set of symbols in your source > code for operators and functions (e.g. integral, sum, dot and cross-product, > …), as well as variables (the standard upper and lower-case greek for > example, along with things like super- and sub-scripting, bold/it

Re: [Haskell-cafe] Re: Endianess

2008-05-14 Thread Henning Thielemann
On Tue, 13 May 2008, Achim Schneider wrote: Jed Brown <[EMAIL PROTECTED]> wrote: It's not that simple with bits. They lack consistency just like the usual US date format and the way Germans read numbers. So you claim that you pronounce 14 tenty-four? In German pronunciation is completely u

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Alec Berryman
Patrick Surry on 2008-05-14 09:43:44 -0400: > Probably a silly question, but for me one of the nice things about > Haskell is that it's a lot like just writing math(s). But in contrast > to math you lose a lot of notational flexibility being limited to the > ascii character set in your source cod

[Haskell-cafe] Re: Richer (than ascii) notation for haskell source?

2008-05-14 Thread Achim Schneider
"Patrick Surry" <[EMAIL PROTECTED]> wrote: > Probably a silly question, but for me one of the nice things about > Haskell is that it's a lot like just writing math(s). But in contrast > to math you lose a lot of notational flexibility being limited to the > ascii character set in your source code

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-14 Thread Jules Bean
PR Stanley wrote: Paul: What is the underlying rationale for the Maybe data type? It is the equivalent of a database field that can be NULL. Paul: shock, horror! the null value or the absence of any value denoted by null is not really in harmony with the relational model.

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Bulat Ziganshin
Hello Patrick, Wednesday, May 14, 2008, 5:43:44 PM, you wrote: > It would be nice to be able to use a richer set of symbols in your ghc supports UTF-8 encoded haskell sources and there are lots of utf-8 enabled editors available -- Best regards, Bulatmailto:[EMAIL

[Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Patrick Surry
Probably a silly question, but for me one of the nice things about Haskell is that it's a lot like just writing math(s). But in contrast to math you lose a lot of notational flexibility being limited to the ascii character set in your source code. It would be nice to be able to use a richer

Re: [Haskell-cafe] Monad for HOAS?

2008-05-14 Thread Lauri Alanko
On Wed, May 14, 2008 at 10:11:17AM +0100, Edsko de Vries wrote: > Suppose we have some data structure that uses HOAS; typically, a DSL > with explicit sharing. For example: > > > data Expr = One | Add Expr Expr | Let Expr (Expr -> Expr) > > When I use such a data structure, I find myself writing

Re: [Haskell-cafe] Commutative monads vs Applicative functors

2008-05-14 Thread Janis Voigtlaender
Ronald Guida wrote: From what I have read about applicative functors, they are weaker than monads because with a monad, I can use the results of a computation to select between alternative future computations and their side effects, whereas with an applicative functor, I can only select between t

[Haskell-cafe] Re: Trying to avoid duplicate instances

2008-05-14 Thread Eric Stansifer
Thanks for your detailed input -- I appreciate seeing these rather abstract techniques being applied to specific problems. Tom Nielsen pointed me in the direction of the solution you've supplied, so I should have replied to the list that my question had been addressed. Anyhow, I now have code tha

[Haskell-cafe] Monad for HOAS?

2008-05-14 Thread Edsko de Vries
Hi, Suppose we have some data structure that uses HOAS; typically, a DSL with explicit sharing. For example: > data Expr = One | Add Expr Expr | Let Expr (Expr -> Expr) When I use such a data structure, I find myself writing expressions such as > Let foo $ \a -> > Let bar $ \b -> > Add a b It

Re: [Haskell-cafe] Commutative monads vs Applicative functors

2008-05-14 Thread Bruno Oliveira
Hello, On 14 May 2008, at 02:06, Ronald Guida wrote: I have a few questions about commutative monads and applicative functors. From what I have read about applicative functors, they are weaker than monads because with a monad, I can use the results of a computation to select between alte