Re: [Haskell-cafe] Why is $ right associative instead of leftassociative?

2006-02-12 Thread Marcin 'Qrczak' Kowalczyk
Brian Hulley [EMAIL PROTECTED] writes: My final suggestion if anyone is interested is as follows: 1) Use : for types 2) Use , instead of ; in the block syntax so that all brace blocks can be replaced by layout if desired (including record blocks) 3) Use ; for list cons. ; is already used

Re: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-12 Thread Tomasz Zielonka
On Sun, Feb 12, 2006 at 01:57:07PM +0100, Daniel Fischer wrote: Am Sonntag, 12. Februar 2006 04:23 schrieb Juan Carlos Arevalo Baeza: optional :: GenParser tok st a - GenParser tok st () optional p = do{ p; return ()} | return () Now, this completely loses the result of the

Re: [Haskell-cafe] Haskell XSLT interpreter?

2006-02-12 Thread Colin Paul Adams
Neil == Neil Mitchell [EMAIL PROTECTED] writes: In what way is the document() function not pure? Neil See [http://www.w3schools.com/xsl/func_document.asp]. In Neil particular their example: Neil xsl:value-of Neil select=document('celsius.xml')/celsius/[EMAIL PROTECTED]/

Re: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-12 Thread Juan Carlos Arevalo Baeza
Tomasz Zielonka wrote: On Sun, Feb 12, 2006 at 01:57:07PM +0100, Daniel Fischer wrote: Your above parser would be option Nothing (fmap Just p) -- or you might use liftM. Both are easy enough. If you think the naming is unfortunate, I wouldn't flatly contradict, but it's too late now, I

Re: [Haskell-cafe] Haskell XSLT interpreter?

2006-02-12 Thread Neil Mitchell
It does, in practise - but this might not be done as part of the tranformation - it might be done as part of the preparation. It can't be done before any transformations, since the URI can be a function, and the result of that function might be defined in terms of transformations and the nodes

Re: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-12 Thread Tomasz Zielonka
On Sun, Feb 12, 2006 at 06:22:46AM -0800, Juan Carlos Arevalo Baeza wrote: The only programs it would break are those that specify it at the end (they'd require an extra return (), right? I can imagine many other cases, but none of them very likely. This brings me to wonder also if it'd

Re[2]: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-12 Thread Bulat Ziganshin
Hello Juan, Sunday, February 12, 2006, 5:22:46 PM, you wrote: JCABThe only programs it would break are those that specify it at the end JCAB (they'd require an extra return (), right? JCABThis brings me to wonder also if it'd be possible for the compilers JCAB to add a little bit more

Re: [Haskell-cafe] Re[2]: Streams: the extensible I/O library

2006-02-12 Thread Marcin 'Qrczak' Kowalczyk
Bulat Ziganshin [EMAIL PROTECTED] writes: i reported only the speed of the buffering transformers. this don't include speed of char encoding that should be very low at this time. Recoding will be slow if it's done on top of buffering and if encoding itself has heavy startup. Buffering should

Re[2]: [Haskell-cafe] Re[2]: Streams: the extensible I/O library

2006-02-12 Thread Bulat Ziganshin
Hello Marcin, Sunday, February 12, 2006, 8:04:26 PM, you wrote: i reported only the speed of the buffering transformers. this don't include speed of char encoding that should be very low at this time. MQK Recoding will be slow if it's done on top of buffering and if encoding MQK itself has

Re: [Haskell-cafe] Haskell XSLT interpreter?

2006-02-12 Thread Lennart Augustsson
Neil Mitchell wrote: In what way is the document() function not pure? See [http://www.w3schools.com/xsl/func_document.asp]. In particular their example: xsl:value-of select=document('celsius.xml')/celsius/[EMAIL PROTECTED]/ i.e. this function needs to load the file celsius.xml. Note that

Re: [Haskell-cafe] Associated Type Synonyms question

2006-02-12 Thread Niklas Broberg
On 2/10/06, Ross Paterson [EMAIL PROTECTED] wrote: On Fri, Feb 10, 2006 at 05:20:47PM +0100, Niklas Broberg wrote: - when looking at the definition of MonadWriter the Monoid constraint is not strictly necessary, and none of the other mtl monads have anything similar. Is it the assumption

Re: [Haskell-cafe] Re[2]: Streams: the extensible I/O library

2006-02-12 Thread Marcin 'Qrczak' Kowalczyk
Bulat Ziganshin [EMAIL PROTECTED] writes: MQK It should be possible to use iconv for recoding. Iconv works on MQK blocks and it should not be applied to one character at a time. recoding don't need any startup. Calling iconv (or other similar routine) does need startup. And you really don't

Re: [Haskell-cafe] Re[2]: Streams: the extensible I/O library

2006-02-12 Thread Marcin 'Qrczak' Kowalczyk
Bulat Ziganshin [EMAIL PROTECTED] writes: recoding don't need any startup. each vGetChar or vPutChar just executes one or more vGetByte/vPutByte calls, according to encoding rules. this should be fast enough Hmm, your interface for the encoder (String - [Word8]) doesn't support stateful

Re: [Haskell-cafe] round function

2006-02-12 Thread Sebastian Sylvan
On 2/12/06, Chatzianastassiou Achilleas [EMAIL PROTECTED] wrote: Hi all, I am trying to implement a function that finds the significant figure of a number to a specified point i.e. 2.5 3 = 2.556. I have implemented something like: sig :: (RealFrac a, Integral b) = a - Int - a sig x y =

Re: [Haskell-cafe] round function

2006-02-12 Thread Chatzianastassiou Achilleas
Thanks for the anwser Sebastian, this seems to work, however I am trying to implement something like Main myfunction 123.456 2 120.0 From: Sebastian Sylvan [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Chatzianastassiou Achilleas [EMAIL PROTECTED] CC: haskell-cafe@haskell.org Subject: Re:

Re: [Haskell-cafe] round function

2006-02-12 Thread J. Garrett Morris
I think the function you're looking for is: myRound n places = round (n / fromIntegral factor) * factor where factor = 10 ^ (places - 1) In this case, 10 ^ (places - 1) has integral type (either Int or Integer). I need it to be a fractional type to divide n by it, so I use fromIntegral to