Re: [Haskell-cafe] Question about arrows

2007-08-03 Thread Bryan Burgers
On 8/3/07, Lewis-Sandy, Darrell <[EMAIL PROTECTED]> wrote: > > Is there a class property of the Control.Arrow class that represents the > evaluatation of an arrow: > > eval :: (Arrow a)=>a b c->b->c > You could always use the ArrowEval class. Granted, it doesn't exist, so you'd have to write it, b

Re[4]: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Bulat Ziganshin
Hello Claus, Friday, August 3, 2007, 7:29:32 PM, you wrote: >> how about *Object.File.Line.CurPtr++ = *AnotherObject.File.Line.CurPtr++ ? >> ;) > what's the difference?-) > let p = Object.File.Line.CurPtr > let q = AnotherObject.File.Line.CurPtr > do { w p =<< r q; i p; i q } bac

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Bulat Ziganshin
Hello apfelmus, Saturday, August 4, 2007, 12:22:53 AM, you wrote: > avoid the small layer of imperative code, of course. But the more you > treat imperative code as somewhat pure, the greater the danger that the > purely functional logic will be buried inside a mess of imperative code. > In other

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Twan van Laarhoven
Antoine Latter wrote: On 8/3/07, Chris Smith <[EMAIL PROTECTED]> wrote: Yes, unless of course you did: instance (Monad m, Num n) => Num (m n) or some such nonsense. :) I decided to take this as a dare - at first I thought it would be easy to declare (Monad m, Num n) => m n to be an ins

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Antoine Latter
On 8/3/07, Chris Smith <[EMAIL PROTECTED]> wrote: > Yes, unless of course you did: > > instance (Monad m, Num n) => Num (m n) > > or some such nonsense. :) I decided to take this as a dare - at first I thought it would be easy to declare (Monad m, Num n) => m n to be an instance of Num (just l

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Stefan O'Rear
On Fri, Aug 03, 2007 at 05:48:18PM -0700, Brandon Michael Moore wrote: > General purpose brackets are overkill here. I would really like a simple > monadic case. What's so bad about > > caseM mexpr of > p1 -> branch1 > p2 -> branch2 > > > > (mexpr >>= \e -> case e of > p1 -> branch1 >

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Brandon Michael Moore
> Also, note, if you use the operators in Control.Applicative, then: > > return $ foo $(bar1) $(bar2) $(bar3) ... > > can be: > > return foo <*> bar1 <*> bar2 <*> bar3 ... > > or: > > foo <$> bar1 <*> bar2 <*> bar3 > > I don't (personally) see how that's any more cryptic than placing

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Claus Reinke
mytransaction = foo `liftM` r xvar0 `ap` r xvar1 .. where r = readTVar I really find it difficult to articulate why this isn't acceptable, because it seems so obvious to me! It's short yes, but I really don't think it's very clear... if it is any consolation, i don't use that style myself

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Dan Doel
On Friday 03 August 2007, Sebastian Sylvan wrote: > On 03/08/07, Claus Reinke <[EMAIL PROTECTED]> wrote: > > ah, a concrete example. but isn't that the typical use case for ap? > > > > mytransaction = foo `liftM` r xvar0 `ap` r xvar1 .. > > where r = readTVar > > I really find it difficult to a

Re: [Haskell-cafe] Re: HDBC or HSQL

2007-08-03 Thread Alex Jacobson
Have you looked at the HAppS.DBMS.IxSet? It gives you a type safe way to query indexed collections. -Alex- Isto Aho wrote: Hi, I'd like to store small matrices into a db. Number of rows and columns may vary in a way not known in advance. One might use a relation (matrixId, col, row, value)

[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) <- runInteractiveComman

Re: [Haskell-cafe] Re: HDBC or HSQL

2007-08-03 Thread Alex Jacobson
Will be pushing out the refactored happs repos in the next 2 weeks. The gist is: * HAppS.IxSet provides efficient query operations on haskell sets. * HAppS.State provides ACID, replicated, and soon sharded access to your application state. * HAppS.Network will provide server side

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Sebastian Sylvan
On 03/08/07, Claus Reinke <[EMAIL PROTECTED]> wrote: > > mytransaction = do { > > x0 <- readTVar xvar0 > > x1 <- readTVar xvar1 > > : > > xn <- readTVar xvarn > > return $ foo x0 x1 .. xn > > } > > > > Versus > > > > mytransaction = return $ foo $(readTVar xvar0) $(readTVar xvar1) .. > > $(rea

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi > > > do case x of > > > [] -> return 1 > > > (y:ys) -> g y >>= \temp -> f temp > > > See the rule about always binding to the previous line of a do block. > > This case then violates that. > > I assumed that the example was equivalent to : > > do case x of > [] -> re

Re: [Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread Sebastian Sylvan
On 03/08/07, Chris Smith <[EMAIL PROTECTED]> wrote: > Sebastian Sylvan <[EMAIL PROTECTED]> wrote: > > I'd also like to reiterate my request for a notation that doesn't > > require brackets around the *action* but will also work by applying it > > to a function which when fully applied to its argume

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread david48
On 8/3/07, Neil Mitchell <[EMAIL PROTECTED]> wrote: > > Is it not possible that is desugars to > > do case x of > > [] -> return 1 > > (y:ys) -> g y >>= \temp -> f temp > See the rule about always binding to the previous line of a do block. > This case then violates that. I as

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi > if you write : > > let x = (<-a):x > > is it possible that is desugars into : > > temp <-a > let x = temp:x > > that would'nt work ? That would work, since 'a' doesn't refer to 'x'. I can't think of a real example where it becomes an issue, but the scope within 'a' has changed. > Also : > >

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread david48
On 8/3/07, Neil Mitchell <[EMAIL PROTECTED]> wrote: > temp <- a > let x = temp if you write : let x = (<-a):x is it possible that is desugars into : temp <-a let x = temp:x that would'nt work ? I realize I may be asking dumb questions but being dumb never harmed anyone so :) Also : > do ca

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi > > let x = 12 > > let x = (<- x) > > Okay, so the desugaring process wouldn't terminate in that case! One > could either: (a) try to retain the equivalence in theory, but make it > illegal to use x in a monadic subexpression when defining x; (b) we > could abandon my claim that they are equiv

[Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread Chris Smith
Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > assembler :) it's what our opponents propose - let's Haskell be like > assembler with its simple and concise execution model :) I feel bad that portions of this thread have gotten a bit ugly. I don't have any opponents, so far as I know. I am just t

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Claus Reinke
I'll dig for it later if you like. The essence of the matter was a bunch of functions that looked something like this: foo = do b' <- readTVar b c' <- readTVar c d' <- readTvar d return (b' + c' / d') In other words, a string of readTVar statements, followed by one com

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Dan Weston
Jules Bean wrote: do a <- m b <- n l a x b y becomes l (<- m) x (<- n) y ...with, I suppose, left-to-right evaluation order. This looks 'almost like substitution' which is the goal. Almost? So then (flip f) (<- m) (<- n) does *not* equal f (<- n) (<- m) ? There goes any hope of my u

[Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread apfelmus
Chris Smith wrote: > I'm primarily interested in the two cases where one simply has no > choice about the use of monads: and those are IO and STM. > No, this is not purely functional programming then; but it has > some very compelling advantages to Haskell's implementation of > these, that I'm afr

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Josef Svenningsson
On 8/3/07, Chris Smith <[EMAIL PROTECTED]> wrote: > Neil Mitchell <[EMAIL PROTECTED]> wrote: > > I'm not convinced either, a nice concrete example would let people > > ponder this a bit more. > > I tried to provide something in my response to Simon. Here it is again: > > One could sugar: > >

[Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Chris Smith
david48 <[EMAIL PROTECTED]> wrote: > On 8/3/07, Neil Mitchell <[EMAIL PROTECTED]> wrote: > > > > Hmm, interesting. Consider: > > > > let x = 12 > > let x = (<- x) > > Wouldn't that be forbidden ? > > I'd expect the x in ( <- x ) have to be of type m a. > Yes, unless of course you did: inst

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Bulat Ziganshin
Hello Chris, Friday, August 3, 2007, 8:09:49 PM, you wrote: > foo = do b' <- readTVar b > c' <- readTVar c > d' <- readTvar d > return (b' + c' / d') > It's true that order of effects *can* be important in monads like IO and > STM. It's also true, though, that probabl

Re[2]: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Bulat Ziganshin
Hello Claus, Friday, August 3, 2007, 8:12:13 PM, you wrote: > f (g (<- mx)) > does this stand for > (a) mx >>= \x-> f (g x) this variant. just like any imperative language (are you used any?). idea of FORmula TRANslator is old and widely used enough to prevent such questions -- Bes

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-03 Thread David Menendez
On 8/1/07, Jeff Polakow <[EMAIL PROTECTED]> wrote: > >But what about an actual object of type 'IO > > Int', say? > > > I usually describe the type resulting from applying a monad a computation. Same here. If "m" is a monad, then "m a" is a computation. (Of course, computations are first-class val

[Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Chris Smith
Neil Mitchell <[EMAIL PROTECTED]> wrote: > > Right. In effect, as a matter of fact, the notation > > > > x <- a > > > > would become equivalent to > > > > let x = (<- a) > > Hmm, interesting. Consider: > > let x = 12 > let x = (<- x) Okay, so the desugaring process wouldn't terminate in

Re: [Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread david48
Sorry for the double post, I posted with the wrong email address and haskell-cafe rejected it. On 8/3/07, Neil Mitchell <[EMAIL PROTECTED]> wrote: > > Right. In effect, as a matter of fact, the notation > > > > x <- a > > > > would become equivalent to > > > > let x = (<- a) > > Hmm, int

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread david48
On 8/3/07, Neil Mitchell <[EMAIL PROTECTED]> wrote: This is how I understand it: > Can you use (<-) outside of a do block? > b >> f (<- a) b >> do { ta <-a; f ta } or b >> a >>= \ta -> f ta > What are the semantics of > do b >> f (<- a) do b >> a >>= \ta -> f ta > Given: > > if (<- a) then f

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread David Roundy
On Fri, Aug 03, 2007 at 02:41:05PM +0200, Mirko Rahn wrote: > >>>rewrite *p++=*q++ in haskell? > > >it's one of C idioms. probably, you don't have enough C experience to > >understand it :) > > Maybe, but how can *you* understand it, when the standard is vague about it? > > It could be > > A: *

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi > > do { do { a; b}; c } > > > > is still the same as > > > > do { a; do { b; c } } > > > > yes? no? perhaps? sometimes? how long did it take you? > > I'm not entirely sure I understand the point here. The monad laws are > defined in terms of >>= and return. They have never had anythi

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Claus Reinke
mytransaction = do { x0 <- readTVar xvar0 x1 <- readTVar xvar1 : xn <- readTVar xvarn return $ foo x0 x1 .. xn } Versus mytransaction = return $ foo $(readTVar xvar0) $(readTVar xvar1) .. $(readTVar xvarn) ah, a concrete example. but isn't that the typical use case for ap? mytransaction

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Dan Piponi
On 8/3/07, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > | Couldn't this be best done with McBride and Patterson's Applicative > | idiom notation? > Does anyone have a pointer to a stand-alone description of "full-scale idiom > notation". > S The full paper is here: http://www.cs.nott.ac.uk/~c

[Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread Chris Smith
Sebastian Sylvan <[EMAIL PROTECTED]> wrote: > I'd also like to reiterate my request for a notation that doesn't > require brackets around the *action* but will also work by applying it > to a function which when fully applied to its argument returns an > action (i.e.: $foo x y + $bar z w, rather

[Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Chris Smith
Claus Reinke <[EMAIL PROTECTED]> wrote: > to illustrate why some of us are concerned about this extension, > a few examples might help. Claus, I've been saving your message in order to respond to it when I have the time to look over it in detail. I don't think there will be forthcoming answers

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Sebastian Sylvan
On 03/08/07, apfelmus <[EMAIL PROTECTED]> wrote: > Chris Smith wrote: > > Also, I got so frustrated that I ended up abandoning some code > > recently because STM is, in the end, so darn hard to use as a > > result of this issue. I'd love to see this solved, and I'm quite > > eager to do it. > > Thi

Re: RE [Haskell-cafe] Monad Description For Imperative

2007-08-03 Thread Greg Meredith
Haskellians, i am delighted to see vigorous exchange that actually resulted in change of positions. i confess i was going to give up, but glad others stepped into the breach. This is yet another indication of what an unusual community this is. Best wishes, --greg Date: Fri, 3 Aug 2007 13:43:32

[Haskell-cafe] RE: monad subexpressions

2007-08-03 Thread Chris Smith
Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > Furthermore there must be no lambda between the "monadic splice" and the "do". I'm curious about this. One could sugar: do tax <- getTax return $ map (\price -> price * (1 + tax)) bill into: do return $ map (\price -> price * (1 +

Re: [Haskell-cafe] Question about arrows

2007-08-03 Thread J. Garrett Morris
On 8/3/07, Lewis-Sandy, Darrell <[EMAIL PROTECTED]> wrote: > > Is there a class property of the Control.Arrow class that represents the > evaluatation of an arrow: > > eval :: (Arrow a)=>a b c->b->c > There isn't because that type signature isn't valid in general. Consider the Kleisli arrows, for

[Haskell-cafe] Question about arrows

2007-08-03 Thread Lewis-Sandy, Darrell
Is there a class property of the Control.Arrow class that represents the evaluatation of an arrow: eval :: (Arrow a)=>a b c->b->c I am writing some higher order code that I would like to work with either functions or partial functions (implemented as balanced binary search trees) and don't

Re: [Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi > > Can you combine let and do? > > > > do let x = (<- a) > >f x > > Right. In effect, as a matter of fact, the notation > > x <- a > > would become equivalent to > > let x = (<- a) Hmm, interesting. Consider: let x = 12 let x = (<- x) Currently, in let x = ... the x is in scope

[Haskell-cafe] Haskell FCGI server.

2007-08-03 Thread George Moschovitis
Dear devs, is it possible to create a FCGI server that listens to a specific port using the Haskell FCGI library? The front end web server would then communicate with this back end FCGI server through this port. A small example would be really appreciated. thanks, George. -- http://nitroproject

[Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread Chris Smith
Neil Mitchell <[EMAIL PROTECTED]> wrote: > Thinking on the semantic issue for the moment: > > Can you use (<-) outside of a do block? Good question, but my answer is a strong no! Syntactic sugar for monads has always been tied to do blocks; promoting it outside of contexts where "do" announces

RE: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Simon Peyton-Jones
| f (g (<- mx)) | | does this stand for | | (a) mx >>= \x-> f (g x) | (b) f (mx >>= \x-> (g x)) | (c) none of the above, because there's no do | (d) something else entirely For me the answer is definitely (c). Furthermore there must be no lambda between the "monadic splice" a

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Jules Bean
Simon Peyton-Jones wrote: Does anyone have a pointer to a stand-alone description of "full-scale idiom notation". http://www.haskell.org/haskellwiki/Idiom_brackets I think I've seen something more detailed but I don't know if it was in one of Conor's papers, or if it was personal conversatio

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Claus Reinke
to illustrate why some of us are concerned about this extension, a few examples might help. consider: f (g (<- mx)) does this stand for (a) mx >>= \x-> f (g x) (b) f (mx >>= \x-> (g x)) (c) none of the above, because there's no do (d) something else entirely if (a/b), does the

[Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Chris Smith
apfelmus <[EMAIL PROTECTED]> wrote: > I still think that this syntax extension has profound impact and is a > bad idea. Simon's and Neill's use case was the dreaded name-supply monad > where the order of effects really doesn't matter up to alpha-conversion. > The objection to that use case is that

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

2007-08-03 Thread Duncan Coutts
On Fri, 2007-08-03 at 14:51 +, Dave Bayer wrote: > The Hackage/Cabal universe takes the perspective that one is a committed > Haskell user, and one wants the same diversity of tools enjoyed, say, in > the Perl universe. When one uses Haskell to write a tool whose use is > standalone and not Ha

Re: Re[2]: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Claus Reinke
can you please rewrite *p++=*q++ in haskell? do { w p =<< r q; i p; i q } how about *Object.File.Line.CurPtr++ = *AnotherObject.File.Line.CurPtr++ ? ;) what's the difference?-) let p = Object.File.Line.CurPtr let q = AnotherObject.File.Line.CurPtr do { w p =<< r q; i p; i q }

[Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread Chris Smith
Neil Mitchell <[EMAIL PROTECTED]> wrote: > We started with 4 suggestions, and as far as I can tell, are > left with only one (<- ...). > For the record, my comments on (<- ...) where not objections, but > merely "thoughts out loud", and I could certainly see myself using > that syntax in a day to

RE: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Simon Peyton-Jones
| Couldn't this be best done with McBride and Patterson's Applicative | idiom notation? | | So the above would become | | [[l m (pure x) n (pure y)]] (or something like that) | | It would have the advantage of being usable with any Applicative, not | just Monads. Does anyone have a pointer to

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

2007-08-03 Thread Dave Bayer
Bryan O'Sullivan 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 nice

Re: [Haskell-cafe] Perfect example

2007-08-03 Thread Dan Piponi
On 8/2/07, Jon Harrop <[EMAIL PROTECTED]> wrote: > Any suggestions for a perfect example that uniquely demonstrates the benefits > of the Haskell language compared to other languages? For short and sweet, power series is a nice example. Try http://www.polyomino.f2s.com/david/haskell/hs/PowerSeries

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Jules Bean
Dan Piponi wrote: On 8/3/07, Jules Bean <[EMAIL PROTECTED]> wrote: do a <- m b <- n l a x b y becomes l (<- m) x (<- n) y Couldn't this be best done with McBride and Patterson's Applicative idiom notation? So the above would become [[l m (pure x) n (pure y)]] (or something li

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Dan Piponi
On 8/3/07, Jules Bean <[EMAIL PROTECTED]> wrote: > do >a <- m >b <- n >l a x b y > > becomes > > l (<- m) x (<- n) y Couldn't this be best done with McBride and Patterson's Applicative idiom notation? So the above would become [[l m (pure x) n (pure y)]] (or something like that)

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

2007-08-03 Thread Dougal Stanton
On 03/08/07, Bryan O'Sullivan <[EMAIL PROTECTED]> wrote: > 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/ I'll add that to the list of "things that must be done". That list seems, necessarily, to

Re[2]: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Bulat Ziganshin
Hello Claus, Friday, August 3, 2007, 5:12:26 PM, you wrote: >> can you please rewrite *p++=*q++ in haskell? > do { w p =<< r q; i p; i q } how about *Object.File.Line.CurPtr++ = *AnotherObject.File.Line.CurPtr++ ? ;) > but whatever line-noise one prefers, this still seems a call for > bett

Re[2]: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Bulat Ziganshin
Hello Mirko, Friday, August 3, 2007, 4:41:05 PM, you wrote: >> result is that currently C code rewritten in Haskell becomes much >> larger and less readable. > Larger should not be that issue and readability depends on the reader as > your C example shows. Some Haskellers would very quickly reco

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

2007-08-03 Thread Bryan O'Sullivan
Dougal Stanton wrote: I had to do this recently, so you might be interested in my approach: The idea here is to run arbitrary text (blog posts) through Markdown and Smartypants before sending them out to the wider world. Pardon me while I ve

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Claus Reinke
can you please rewrite *p++=*q++ in haskell? assuming these operations i :: V a -> IO (V a) -- incr var addr, return old addr r :: V a -> IO a -- read var w :: V a -> a -> IO () -- write var value and this unfolded translation do { qv <- r q; w p qv; i p; i q } assuming

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi Thinking on the semantic issue for the moment: Can you use (<-) outside of a do block? b >> f (<- a) What are the semantics of do b >> f (<- a) where does the evaluation of a get lifted to? Given: if (<- a) then f (<- b) else g (<- c) Do b and c both get monadic bindings regardless of a

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi Perhaps we need to cool this thread down a little bit, and refocus. I personally choose never to use ++ as anything but a statement, since my brain works that way. Other people find different things natural, so can pick what they choose. The one thing you can guarantee is that discussing it isn

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Mirko Rahn
rewrite *p++=*q++ in haskell? it's one of C idioms. probably, you don't have enough C experience to understand it :) Maybe, but how can *you* understand it, when the standard is vague about it? It could be A: *p=*q; p+=1; q+=1; B: *p=*q; q+=1; p+=1; C: tp=p; tq=q; p+=1; q+=1; *tp=*tq; ..

Re[2]: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Miguel Mitrofanov
>> rewrite *p++=*q++ in haskell? MR> I always reject such codes when produced by my students. I don't think it's a good idea to reject working code. MR> I even do not understand what you are trying to achieve. Well, that just means that your students are a bit smarter than you. And I'd like to

Re[2]: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Miguel Mitrofanov
>> rewrite *p++=*q++ in haskell? MR> I always reject such codes when produced by my students. It is just MR> unreadable. I even do not understand what you are trying to achieve. MR> However, gcc seems it to compile to something like MR> *p = *(p+1) ; *q = *(q+1) MR> But for what is the '=' good

Re[2]: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Bulat Ziganshin
Hello Mirko, Friday, August 3, 2007, 3:32:57 PM, you wrote: >> rewrite *p++=*q++ in haskell? > I always reject such codes when produced by my students. It is just > unreadable. it's one of C idioms. probably, you don't have enough C experience to understand it :) > So rewriting it in Haskell

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Mirko Rahn
rewrite *p++=*q++ in haskell? *p = *(p+1) ; *q = *(q+1) If that's true then GCC has gone insane, because they are completely different. Of course you are right, I just observed at the wrong place..., sorry for that. Though, as any C programmer knows, you really should be using memcp

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Mirko Rahn
rewrite *p++=*q++ in haskell? I always reject such codes when produced by my students. It is just unreadable. I even do not understand what you are trying to achieve. However, gcc seems it to compile to something like *p = *(p+1) ; *q = *(q+1) But for what is the '=' good for? So rewriti

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Lutz Donnerhacke
* Bulat Ziganshin wrote: > Hello apfelmus, >> I still think that this syntax extension has profound impact and is a >> bad idea. > > can you please rewrite *p++=*q++ in haskell? p = q ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.hask

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Claus Reinke
I've heard Simon (Peyton-Jones) twice now mention the desire to be able to embed a monadic subexpression into a monad. That would be http://article.gmane.org/gmane.comp.lang.haskell.prime/2267 .. Thoughts? what is the problem you're trying to solve, and is it worth the complication in synta

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Bulat Ziganshin
Hello apfelmus, Friday, August 3, 2007, 12:05:22 PM, you wrote: > I still think that this syntax extension has profound impact and is a > bad idea. can you please rewrite *p++=*q++ in haskell? -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Jules Bean
Jules Bean wrote: do a <- m b <- n l a x b y becomes l (<- m) x (<- n) y ...with, I suppose, left-to-right evaluation order. This looks 'almost like substitution' which is the goal. Having read the thread SPJ pointed to, I should point out that using a mixture of Applicative and Mo

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

2007-08-03 Thread Dougal Stanton
On 03/08/07, Dave Bayer <[EMAIL PROTECTED]> wrote: > I'm actually calling > Markdown.pl on tiny files (source code of lengths a human would read), and > it is certainly sluggish enough to be a fair test.) I had to do this recently, so you might be interested in my approach:

RE: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Simon Peyton-Jones
| > I've heard Simon (Peyton-Jones) twice now mention the desire to be able | > to embed a monadic subexpression into a monad. That would be | > http://article.gmane.org/gmane.comp.lang.haskell.prime/2267 and in the | > recent OSCON video. | | I still think that this syntax extension has profound

Re: [Haskell-cafe] monad subexpressions

2007-08-03 Thread Jules Bean
Neil Mitchell wrote: Hi Chris, I've heard Simon (Peyton-Jones) twice now mention the desire to be able to embed a monadic subexpression into a monad. I think this is a fantastic idea, please do so! $( expr ) -- conflicts with template haskell ( <- expr ) -- makes sense, and I

[Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread apfelmus
Chris Smith wrote: > I've heard Simon (Peyton-Jones) twice now mention the desire to be able > to embed a monadic subexpression into a monad. That would be > http://article.gmane.org/gmane.comp.lang.haskell.prime/2267 and in the > recent OSCON video. I still think that this syntax extension ha

RE: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Simon Peyton-Jones
See also this thread http://www.haskell.org/pipermail/haskell-prime/2007-July/002269.html Magnus made a TH library that does something similar, see http://www.haskell.org/pipermail/haskell-prime/2007-July/002275.html Nesting is important. Consider do { a <- f x ; b <- g a