Re: [Haskell-cafe] invalid character encoding

2005-03-15 Thread Ian Lynagh
On Tue, Mar 15, 2005 at 10:44:28AM +, Ross Paterson wrote: > On Mon, Mar 14, 2005 at 07:38:09PM -0600, John Goerzen wrote: > > I've got some gzip (and Ian Lynagh's Inflate) code that breaks under > > the new hugs with: > > > > : IO.getContents: protocol error (invalid character encoding) > >

[Haskell-cafe] re parser question

2005-03-15 Thread Carter Tazio Schonwald
term :: Parser Int term = do f <- factor do symbol "*" e <- expr return (f * t)<--- replace t with e +++ return f I hope that helps, Carter Schonwald ___ Haskell-Cafe ma

Re: [Haskell-cafe] wxHaskell htmlWindow usage

2005-03-15 Thread Patrick Scheibe
Hi, When I use the htmlWindowLoadPage hw "./test.html" function, everything works fine and I see the content of the test.html page. Cheers Patrick On Tuesday 15 March 2005 15:51, David Owen wrote: > Good day all, > > I am attempting to display html pages using wxHaskell's HtmlWindow > func

RE: [Haskell-cafe] wxHaskell htmlWindow usage

2005-03-15 Thread Bayley, Alistair
> From: David Owen [mailto:[EMAIL PROTECTED] > > htmlWindowSetPage might be the wrong function to use for this > or I might > just be using it incorrectly. This may well be more > complicated than I'm > hoping it is too! I-Am-Not-A-WxHaskell-Expert, but... a quick google finds this page:

RE: [Haskell-cafe] Parser problem continued

2005-03-15 Thread Nicola Whitehead
Thanks folks! Writing it in a lispy manner seems to work. I see what Arthur means about the layout - I think I'm still thinking too much in C. :) Nik Dr Nik Freydís Whitehead University of Akureyri, Iceland * Having the moral h

Re: [Haskell-cafe] Parser problem continued

2005-03-15 Thread Arthur Baars
The layout of your code is very important when writing haskell code: Your code : expr = do t <- term do symbol "+" e <- expr return e return (t + e) +++ return t is equivalent to: expr = do { t <- term ; do { symbol "+" ;

Re: [Haskell-cafe] Parser problem continued

2005-03-15 Thread Tomasz Zielonka
On Tue, Mar 15, 2005 at 03:44:55PM -, Nicola Whitehead wrote: > perhaps like this: > > > expr = do t <- term > > (do symbol "+" > > e <- expr > > return (t+e) > > ) > > +++ > > (return t) > > > >although I think you may also w

RE: [Haskell-cafe] Parser problem continued

2005-03-15 Thread Nicola Whitehead
perhaps like this: > expr = do t <- term > (do symbol "+" > e <- expr > return (t+e) > ) > +++ > (return t) > > >although I think you may also want a 'try' before the first alternative. No, that still gives the same undefined var

Re: [Haskell-cafe] Parser problem continued

2005-03-15 Thread robert dockins
expr :: Parser Int expr = do t <- term do symbol "+" e <- expr return e return (t + e) +++ return t<- 't' is not in scope at the arrow. t only exists inside the do block, and your code parses like this ( do t <- return (t+e) )

Re: [Haskell-cafe] Parser problem continued

2005-03-15 Thread Henning Thielemann
On Tue, 15 Mar 2005, Nicola Whitehead wrote: Curiouser and curiouser... expr :: Parser Int expr = do t <- term do symbol "+" e <- expr return (t + e) +++ return t solves the undefined variable problem but introduces a new 'Last operator in do {...} must be an ex

[Haskell-cafe] Parser problem continued

2005-03-15 Thread Nicola Whitehead
Curiouser and curiouser...   expr :: Parser Intexpr = do t <- term  do symbol "+" e <- expr  return (t + e)   +++ return t solves the undefined variable problem but introduces a new 'Last operator in do {...} must be an _expression_' error, which then disa

[Haskell-cafe] wxHaskell htmlWindow usage

2005-03-15 Thread David Owen
Good day all, I am attempting to display html pages using wxHaskell's HtmlWindow functions. I am hoping that it is indeed possible for me to do just that and that I haven't misunderstood what HtmlWindow is used for. My code so far will create a frame, a button and an HtmlWindow and other assor

Re: [Haskell-cafe] Parity of the number of inversions of a permutation

2005-03-15 Thread Henning Thielemann
On Tue, 15 Mar 2005, Ben Rudiak-Gould wrote: Henning Thielemann wrote: I' searching for a function which sorts the numbers and determines the parity of the number of inversions. I assume that there are elegant and fast algorithms for this problem (n * log n time steps), e.g. a merge sort algorit

Re: [Haskell-cafe] invalid character encoding

2005-03-15 Thread Ross Paterson
On Tue, Mar 15, 2005 at 08:12:48AM -0600, John Goerzen wrote: > > [...] but Hugs is now much stricter, because character streams now > > use the encoding determined by the current locale (for the C locale, that > > means ASCII only). > > Hmm, this seems to be completely undocumented. It's mention

Re: [Haskell-cafe] invalid character encoding

2005-03-15 Thread John Goerzen
On Tue, Mar 15, 2005 at 10:44:28AM +, Ross Paterson wrote: > On Mon, Mar 14, 2005 at 07:38:09PM -0600, John Goerzen wrote: > > I've got some gzip (and Ian Lynagh's Inflate) code that breaks under > > the new hugs with: > > > > : IO.getContents: protocol error (invalid character encoding) > >

Re: [Haskell-cafe] Parser question

2005-03-15 Thread Jules Bean
On 15 Mar 2005, at 12:38, Mark Carroll wrote: Variables (although why they're called that in Haskell I'm not sure) Because the value that they denote can vary between different calls of the same function? Jules ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] Parity of the number of inversions of a permutation

2005-03-15 Thread Ben Rudiak-Gould
Henning Thielemann wrote: I' searching for a function which sorts the numbers and determines the parity of the number of inversions. I assume that there are elegant and fast algorithms for this problem (n * log n time steps), e.g. a merge sort algorithm. This is a rather nice little problem. I t

Re: [Haskell-cafe] Parser question

2005-03-15 Thread Mark Carroll
On Tue, 15 Mar 2005, Nicola Whitehead wrote: (snip) > term :: Parser Int > term = do f <- factor >do symbol "*" >e <- expr >return (f * t) > +++ return f (snip) > symbol and natural are defined elsewhere and work fine, but when I compile it

Re: [Haskell-cafe] Parser question

2005-03-15 Thread Henning Thielemann
On Tue, 15 Mar 2005, Nicola Whitehead wrote: Hi folks, I have a parser problem. I have a basic calculator program (Graham Hutton's from Nottingham) which contains the following code: -- Define a parser to handle the input expr :: Parser Int expr = do t <- term do symbol "+"

[Haskell-cafe] Parser question

2005-03-15 Thread Nicola Whitehead
Hi folks,   I have a parser problem. I have a basic calculator program (Graham Hutton's from Nottingham) which contains the following code:   -- Define a parser to handle the inputexpr :: Parser Intexpr = do t <- term  do symbol "+"   e <- expr   

Re: [Haskell-cafe] invalid character encoding

2005-03-15 Thread Ross Paterson
On Mon, Mar 14, 2005 at 07:38:09PM -0600, John Goerzen wrote: > I've got some gzip (and Ian Lynagh's Inflate) code that breaks under > the new hugs with: > > : IO.getContents: protocol error (invalid character encoding) > > What is going on, and how can I fix it? A Haskell 98 Handle is a charac