Re: [Haskell-cafe] Beginners arrow question

2008-04-05 Thread Luke Palmer
On Sat, Apr 5, 2008 at 4:00 PM, Cale Gibbard <[EMAIL PROTECTED]> wrote: > GHC has a special syntax for using ArrowApply (which HXT is an > instance of). Whenever the expression to the left of -< needs to > involve a local variable, you can replace -< with -<< and it should > work. To understand

Re: [Haskell-cafe] Beginners arrow question

2008-04-05 Thread Cale Gibbard
On 05/04/2008, Paul Johnson <[EMAIL PROTECTED]> wrote: > myProblem :: (ArrowXml a) -> a XmlTree String > myProblem = proc xml do > name <- getAttrValue "name" -< xml > fmt <- arr lookupFormatter -< name > fmt -< xml > GHC has a special syntax for using ArrowApply (which HXT is an instance

Re: [Haskell-cafe] Beginners arrow question

2008-04-05 Thread Claude Heiland-Allen
Paul Johnson wrote: I'm using arrows for the first time, with HXT. I think I'm getting the hang of it, but one problem has me stumped. I have a function "lookupFormatter" which takes a string and returns an arrow, and I want to use that arrow. Something like this: myProblem :: (ArrowXml a)

Re: [Haskell-cafe] Beginners arrow question

2008-04-05 Thread Miguel Mitrofanov
You can't use variables introduced in "proc" anywhere except on the right side of "-<". OK, you actually can do this, but your arrow should be an instance of ArrowApply (which means that you don't really need it at all, since all such arrows are in fact monads). Your "myProblem" is desugare

[Haskell-cafe] Beginners arrow question

2008-04-05 Thread Paul Johnson
I'm using arrows for the first time, with HXT. I think I'm getting the hang of it, but one problem has me stumped. I have a function "lookupFormatter" which takes a string and returns an arrow, and I want to use that arrow. Something like this: myProblem :: (ArrowXml a) -> a XmlTree String