RE: Bug in do expressions

2002-11-21 Thread Simon Peyton-Jones
Ah, indeed so. Thank you for reporting this. It turned out to be caused by a function written like this f (C a) = ... f (D a b) = ... f other = False The data type changed, and we should have added a new case to the function, but the default case caught it, so there was

Re: Bug in do expressions

2002-11-21 Thread Andrew J Bromage
G'day all. On Thu, Nov 21, 2002 at 09:12:58AM -, Simon Peyton-Jones wrote: So GHC is 30 lines shorter thanks to you. ...and I didn't even have to delete a single line of code myself! Thanks, Simon. Cheers, Andrew Bromage ___

Re: re-opening a closed stdin?

2002-11-21 Thread Glynn Clements
Bernard James POPE wrote: There's probably a really obvious answer to this, but I can't find it. Is there any way in GHC to reopen stdin if it has been closed? You may wonder why I'd want this. Well I'm writing a debugger for Haskell 98 (*) and my debugger wants to do some interaction on

RE: re-opening a closed stdin?

2002-11-21 Thread Simon Marlow
Simon Marlow writes: I've been thinking about duplicating/replacing Handles for a while. Here's a possible interface: -- |Returns a duplicate of the original handle, with its own buffer -- and file pointer. The original handle's buffer is flushed, including -- discarding

RE: re-opening a closed stdin?

2002-11-21 Thread Simon Marlow
You can call 'System.Posix.IO.dup stdin' and save this value. However, I think you then need to explicitely read from this fd as it is not possible to reset what GHC thinks stdin is currently to this new fd (I'll dig into this and maybe we'll get a setStdin :: Fd - IO () from this,

RE: Request: suppress specific warnings at specific places

2002-11-21 Thread Simon Marlow
GHC's excellent warnings are very helpful. They would be somewhat more so if it were possible to suppress a warning about a specific bit of code. One possible syntax (to which I gave no commitment) would be {-# WOFF non-exhaustive pattern matches #-} offending code {-# WON

Re: Request: suppress specific warnings at specific places

2002-11-21 Thread Mike Gunter
If the switches take affect at the line granularity there would seem to be a straightforward implementation that's orthogonal to most everything else: store the excluded regions in separate data structure and check that data structure before printing a message. mike GHC's excellent

Re: re-opening a closed stdin?

2002-11-21 Thread Mark Carroll
On Wed, 20 Nov 2002, Volker Stolz wrote: (snip) The other way involves opening /dev/stdin on hosts that support this (with the same limitation as above), including that that's currently (snip) Sometimes /dev/tty will work too. -- Mark ___

RE: -Werror Request

2002-11-21 Thread Ashley Yakeley
At 2002-11-20 01:38, Simon Peyton-Jones wrote: Done! Thanks! -- Ashley Yakeley, Seattle WA ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

diff in Haskell?

2002-11-21 Thread George Russell
Does anyone happen to have implemented diff in Haskell? Something like diff :: Ord a - [a] - [a] - [DiffElement a] data DiffElement a = InBoth a | InFirst a | InSecond a So for example diff [1,2,3,4,5] [2,3,6,7,4] might return [InFirst 1,InBoth 2,InBoth 3,InSecond

diff in Haskell: clarification

2002-11-21 Thread George Russell
Since various people seem to have misunderstood the problem, I shall try to state it more precisely. What is required is a function diff :: Ord a - [a] - [a] - [DiffElement a] for the type data DiffElement a = InBoth a | InFirst a | InSecond a such that given

Re: diff in Haskell: clarification

2002-11-21 Thread Fergus Henderson
On 21-Nov-2002, George Russell [EMAIL PROTECTED] wrote: There is an algorithm known as Myer's algorithm, but obviously I want it in Haskell rather than C, and it would be nice if someone else had written it so I don't have to. Would a Mercury version help? The Mercury distribution includes a

Re: diff in Haskell?

2002-11-21 Thread Ashley Yakeley
At 2002-11-21 08:37, George Russell wrote: Does anyone happen to have implemented diff in Haskell? Anyone else and I'd think this was a homework question... -- Ashley Yakeley, Seattle WA ___ Haskell mailing list [EMAIL PROTECTED]

Re: diff in Haskell?

2002-11-21 Thread Lloyd Allison
It is not quite diff but there is an edit distance in Haskell here http://www.csse.monash.edu.au/~lloyd/tildeFP/Haskell/1998/Edit01/ it might provide a starting point. (Diff treats a line as a character and, I think, uses an algorithm that's fast for small numbers of changes.) Lloyd -- Lloyd

Re: diff in Haskell: clarification

2002-11-21 Thread Andrew J Bromage
G'day all. On Fri, Nov 22, 2002 at 05:13:07AM +1100, Fergus Henderson wrote: Would a Mercury version help? The Mercury distribution includes a Mercury version of Myer's algorithm: it's in the directory `samples/diff'. Disclaimer: I wrote the Mercury version. That particular algorithm

Re: Random Color

2002-11-21 Thread Dean Herington
Mike T. Machenry wrote: Andrew and list, I am a beginer. I really don't know what I would do if I derived Color from Enum. You say I could create elements that way. Is there some simple example someone could post to the list? Thank you for your help. Here's one way to generate random

Re: Random Color

2002-11-21 Thread Dean Herington
On Thu, 21 Nov 2002, Mike T. Machenry wrote: This program yeilds: Fail: toEnum{Color}: tag (4) is outside of enumeration's range (0,3) in ghc... any ideas why? -mike Hmm. The program works fine for me, using GHC 5.04.1 or Hugs of Oct 2002. Dean On Thu, Nov 21, 2002 at 10:07:12AM