Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread ajb
G'day all. Quoting Robert Dockins <[EMAIL PROTECTED]>: > Eww! Be careful how far you depend on properties of typeclasses, and make > sure you document it when you do. The behaviour of NaN actually makes perfect sense when you realise that it is Not a Number. Things that are not numbers are

Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread Brian Hulley
Brian Hulley wrote: John Meacham wrote: [snip] 1. one really does logically derive from the other, Eq and Ord are like this, the rules of Eq says it must be an equivalance relation and that Ord defines a total order over that equivalance relation. this is a good thing, as it lets you write code

Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread Stephen Forrest
On 4/6/06, Brian Hulley <[EMAIL PROTECTED]> wrote: > What about: > > class Eq a where (==), (/=) :: ... > class PartialOrd a where > (<), (>) :: a->a->Bool > x > y = y < x > > class (PartialOrd a) => TotalOrd a where x <= y = not (y < x) >-- => not meaning inheritance but just a

Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread Brian Hulley
John Meacham wrote: On Thu, Apr 06, 2006 at 10:52:52PM +0100, Brian Hulley wrote: [snip] The problem of allowing classes (in Haskell) to inherit is that you end up with heirarchies which fix the design according to some criteria which may later turn out to be invalid, whereas if there were no hi

Re: [Haskell-cafe] Code Review: Sudoku solver

2006-04-06 Thread David F. Place
On Apr 6, 2006, at 6:05 PM, Daniel Fischer wrote:I've also written a version using David F. Place's EnumSet instead of [Int], that takes less MUT time, but more GC time, so is slower on the 36,628 test,  but faster for a single puzzle. That's a curious result.  Did you compile with optimization?  I

Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread Robert Dockins
On Thursday 06 April 2006 06:44 pm, John Meacham wrote: > On Thu, Apr 06, 2006 at 10:52:52PM +0100, Brian Hulley wrote: [snip a question about Eq and Ord classes] > well, there are a few reasons you would want to use inheritance in > haskell, some good, some bad. > > 1. one really does logically

Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread John Meacham
On Thu, Apr 06, 2006 at 10:52:52PM +0100, Brian Hulley wrote: > >in haskell classes _do_ define interfaces, not concrete > >representations so the problems with inherentence of non-abstract > >classes in OO languages don't apply. > > What I was trying to argue was that inheritance of classes in Ha

Re: [Haskell-cafe] Code Review: Sudoku solver

2006-04-06 Thread Daniel Fischer
Am Mittwoch, 5. April 2006 15:09 schrieb Chris Kuklewicz: > Henning Thielemann wrote: > > On Mon, 3 Apr 2006, Jared Updike wrote: > >> or ambiguously) with your Sudoku solver? A rough mesaure of the > >> difficulty of the unsolved puzzle could be how long the solver took to > >> solve it (number of

Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread Brian Hulley
John Meacham wrote: On Thu, Apr 06, 2006 at 09:31:24PM +0100, Brian Hulley wrote: I've been wondering for a long time if there is a reason why Ord should inherit from Eq and not vice versa, or whether in fact there is any justification for making either Ord or Eq inherit from the other one. Th

Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread Steve Schafer
On Thu, 6 Apr 2006 21:31:24 +0100, you wrote: >I've been wondering for a long time if there is a reason why Ord should >inherit from Eq and not vice versa, or whether in fact there is any >justification for making either Ord or Eq inherit from the other one. Support for the concept of equality/in

Re: [Haskell-cafe] EnumSet with a BSD license

2006-04-06 Thread David F. Place
On Apr 6, 2006, at 10:35 AM, Bulat Ziganshin wrote: 1) wordLength = bitSize (undefined::Word) How'd I miss that one? Thanks. 2) your library will not work with Hugs 2003, what is the latest official (non-beta) version. "Portability : portable" ? Fixed by changing "portable" to "non-porta

Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread John Meacham
On Thu, Apr 06, 2006 at 09:31:24PM +0100, Brian Hulley wrote: > I've been wondering for a long time if there is a reason why Ord should > inherit from Eq and not vice versa, or whether in fact there is any > justification for making either Ord or Eq inherit from the other one. The problem is that

[Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread Brian Hulley
Hi - I've been wondering for a long time if there is a reason why Ord should inherit from Eq and not vice versa, or whether in fact there is any justification for making either Ord or Eq inherit from the other one. For example, Ord and Eq could alternatively be defined as: class Ord a where (<

Re: [Haskell-cafe] Re: [Haskell] What's up with this Haskell runtime error message:

2006-04-06 Thread Michael Goodrich
Thank you all for your excellent comments. I was aware of Hughe's technique and the 'whyfp' paper. I had often thought that some kind of iteration would be necessary to reolve this, and to overcome initially this I was cheating and using one of the values one step late in order to break the close

Re: [Haskell-cafe] Code Review: Sudoku solver

2006-04-06 Thread Tom Schrijvers
On Thu, 6 Apr 2006, Claus Reinke wrote: Curry does not have a constraint solver of its own. It simply delegates all constraints to the FD solver of SICStus Prolog. or that of SWI Prolog (which prompted my attempt to install Curry). which was implemented by..hi, again!-) (*) The SWI-Pr

Re: [Haskell-cafe] Code Review: Sudoku solver

2006-04-06 Thread Claus Reinke
Curry does not have a constraint solver of its own. It simply delegates all constraints to the FD solver of SICStus Prolog. or that of SWI Prolog (which prompted my attempt to install Curry). which was implemented by..hi, again!-) (*) The all_different constraint subsumes the rules that

Re: [Haskell-cafe] Re: [Haskell] What's up with this Haskell runtime error message:

2006-04-06 Thread Robert Dockins
On Apr 6, 2006, at 11:25 AM, Michael Goodrich wrote: Thanks so much for your help. I should have made clear that I was aware that the definitions were mutually dependent. What I was hoping was that Haskell could solve this for me without my having to resort to effectively finessing any se

Re: [Haskell-cafe] EnumSet with a BSD license

2006-04-06 Thread Bulat Ziganshin
Hello David, Wednesday, April 5, 2006, 9:30:33 PM, you wrote: > Since there is some interest in my EnumSet module, I am reposting it > here with a BSD license in anticipation of its rebirth as Data.Set.Enum. pair of comments: 1) wordLength = bitSize (undefined::Word) 2) your library will not wo

Re: [Haskell-cafe] Re: [Haskell] What's up with this Haskell runtime error message:

2006-04-06 Thread Jared Updike
> Thanks so much for your help. I should have made clear that I was aware that > the definitions were mutually dependent. What I was hoping was that Haskell > could solve this for me without my having to resort to effectively finessing > any sequencing considerations. Haskell is a functional lang

Re: [Haskell-cafe] Re: [Haskell] What's up with this Haskell runtime error message:

2006-04-06 Thread Jon Fairbairn
On 2006-04-06 at 11:25EDT "Michael Goodrich" wrote: > Thanks so much for your help. I should have made clear that I was aware that > the definitions were mutually dependent. What I was hoping was that Haskell > could solve this for me without my having to resort to effectively finessing > any sequ

[Haskell-cafe] Re: [Haskell] What's up with this Haskell runtime error message:

2006-04-06 Thread Michael Goodrich
Thanks so much for your help. I should have made clear that I was aware that the definitions were mutually dependent.  What I was hoping was that Haskell could solve this for me without my having to resort to effectively finessing any sequencing considerations. Perhaps I am really asking it to do

Re: [Haskell-cafe] What's up with this Haskell runtime error message:

2006-04-06 Thread Roberto Zunino
Michael Goodrich wrote: Also I know what strict means, but why are you saying that baz is strict? Because otherwise the loop would be OK. For instance if baz were baz x = 100 -- lazy then the equations could be evaluated starting from c0 = baz z0 = 100 rd0 = c0*c0*m = 100*100*m -- etc.