Re: Enum instance for Ratio

2000-03-09 Thread Marc van Dongen
George Russell ([EMAIL PROTECTED]) wrote: : Marc van Dongen wrote: : > Wouldn't that make Enum depend on Ord? : > Doesn't seem to make sense if classes are : > enumerable but not comparable. Of course above I should have said orderable in stead of comparable. : What examples are there of types

PrelList.badHead - has GHC got a hangover?

2000-03-09 Thread George Russell
Sadly my shiny new GHC (downloaded and compiled from CVS last night) seems to have produced an inconsistent .hi file (attached) when compiling the basis. The problem is that badHead is mentioned in a inline bit of gunk, but the type for it isn't specified anywhere. (It's an internal value which d

Re: Enum instance for Ratio

2000-03-09 Thread George Russell
Marc van Dongen wrote: > Wouldn't that make Enum depend on Ord? > Doesn't seem to make sense if classes are > enumerable but not comparable. What examples are there of types for which it would be sensible to implement Enum but not Ord? The concept rather puzzles me. In particular, suppose you do

Re: Enum instance for Ratio

2000-03-09 Thread Marc van Dongen
George Russell ([EMAIL PROTECTED]) wrote: : A logical definition of Enum (to me wearing a mathematical hat) : would be : : succ x = min { y | y > x} : Wouldn't that make Enum depend on Ord? Doesn't seem to make sense if classes are enumerable but not comparable. Regards, Marc

Re: Enum instance for Ratio

2000-03-09 Thread George Russell
A logical definition of Enum (to me wearing a mathematical hat) would be succ x = min { y | y > x} For Ratio this makes no sense, ergo Ratio should not be an instance of Enum. For Float and Doubles it makes a lot of sense (giving nextAfter, which is a commonly used IEEE function not otherwise

Re: Enum instance for Ratio

2000-03-09 Thread Sven Panne
Malcolm Wallace wrote: > I'd say that this is a bug in the Library Report, which seems to > specify this implementation. [...] But for Float, Double, Ratio and friends the report explicitly states that numericEnumFromFooBar has to be used, which generates the finite list. So it's only a bug in al

Re: Enum instance for Ratio

2000-03-09 Thread Malcolm Wallace
Sven writes: > Both GHC and Hugs have a bug in their Prelude for Ratio's Enum > instance. ... The reason for this > is that the default method for enumFromThenTo is used, which truncates > 4%3 to 1 (same for enumFromTo). I'd say that this is a bug in the Library Rep

RE: "panic! (the `impossible' happened):" again

2000-03-09 Thread Simon Peyton-Jones
Yes, this is a known bug. It doesn't happen in my private copy, which I'm eternally just about to commit. I keep not doing it because I'm busy doing ICFP papers. I think I'll just commit it anyway by the end of this week. Simon | -Original Message- | From: George Russell [mailto:[EMAI

Re: "panic! (the `impossible' happened):" again

2000-03-09 Thread George Russell
George Russell wrote: > > Glasgow Haskell seems to be good at doing the impossible . . . > > panic! (the `impossible' happened): > mkWWcpr: not a product > w{-rIZ-} > -> e{-rJ1-} > -> Listener.DispatchMode{-rgO,i-} > -> ExternalEvent.IA{-rgh,i-} GUIEvent.EventInfo{-rsx,i

"panic! (the `impossible' happened): " again

2000-03-09 Thread George Russell
Glasgow Haskell seems to be good at doing the impossible . . . panic! (the `impossible' happened): mkWWcpr: not a product w{-rIZ-} -> e{-rJ1-} -> Listener.DispatchMode{-rgO,i-} -> ExternalEvent.IA{-rgh,i-} GUIEvent.EventInfo{-rsx,i-} Let me know if you want the source fi

RE: hslibs/tools/DtdToHaskll

2000-03-09 Thread Simon Marlow
> (when doing gmake in the fptools directory.) > ../../../ghc/driver/ghc-inplace -o DtdToHaskell -cpp > -fglasgow-exts -syslib text-H40m -OnotDtdToHaskell.o > DtdToTypeDefPP.o > /usr/local/pub-bkb/ghc/fptools/hslibs/data/libHSdata.a(FiniteM > ap__1.o)(.text+0x38): undefined reference t

RE: -O2 == crash

2000-03-09 Thread Simon Marlow
> 2.95.1 > > With -O -O2-for-C it still crashes. With -O it does not. > With -O2-for-C it does not. > > (gdb) bt > #0 0x804932a in Main_zn_fast2 () > #1 0x500c0444 in ?? () > #2 0x500c1fa4 in ?? () > #3 0x468bfc45 in ?? () > Cannot access memory at address 0x8908468b. We could investigate f

another compiler bug found

2000-03-09 Thread Volker Wysk
Hallo. This seems very related to the bug I reported ago. ghc -fno-prune-tydecls -O2 -fallow-undecidable-instances \ -fglasgow-exts -fallow-overlapping-instances -c -o Arglib.o Arglib.hs panic! (the `impossible' happened): mkWWcpr: not a product forall tzq{-rme-}. Arglib.ArgrF{

Enum instance for Ratio

2000-03-09 Thread Sven Panne
Both GHC and Hugs have a bug in their Prelude for Ratio's Enum instance. The following program import Ratio main = print [ 1, 4%(3::Int) .. 2 ] should print [1 % 1,4 % 3,5 % 3,2 % 1] but instead an infinite list of 1%1s is generated. The reason for this is that the default method for

Re: -O2 == crash

2000-03-09 Thread Marc van Dongen
Marcin 'Qrczak' Kowalczyk ([EMAIL PROTECTED]) wrote: : Thu, 9 Mar 2000 01:58:02 -0800, Simon Marlow <[EMAIL PROTECTED]> pisze: : : > So the likely candidate would appear to be your gcc - which version : > do you have installed? : : 2.95.1 : : With -O -O2-for-C it still crashes. With -O it does

hslibs/tools/DtdToHaskll

2000-03-09 Thread George Russell
(when doing gmake in the fptools directory.) ../../../ghc/driver/ghc-inplace -o DtdToHaskell -cpp -fglasgow-exts -syslib text -H40m -OnotDtdToHaskell.o DtdToTypeDefPP.o /usr/local/pub-bkb/ghc/fptools/hslibs/data/libHSdata.a(FiniteMap__1.o)(.text+0x38): undefined reference to `__init_GlaE

Re: -O2 == crash

2000-03-09 Thread Marcin 'Qrczak' Kowalczyk
Thu, 9 Mar 2000 01:58:02 -0800, Simon Marlow <[EMAIL PROTECTED]> pisze: > So the likely candidate would appear to be your gcc - which version > do you have installed? 2.95.1 With -O -O2-for-C it still crashes. With -O it does not. With -O2-for-C it does not. (gdb) bt #0 0x804932a in Main_zn_f

RE: -O2 == crash

2000-03-09 Thread Simon Marlow
> The following code crashes when compiled with -O2. With -O it does > not crash. Some trivial modifications make the crash go away. Sorry, I can't repeat this one. As far as I can tell, using -O2 does three things - it forces -fvia-C (on by default anyway) - it passes -O2 to g

RE: _ is not always small (syntactically :-)

2000-03-09 Thread Simon Marlow
> GHC's lexer (function Lex.mk_var_token) treats names starting with > an underscore followed by an uppercase letter as a constructor (conid) > and not as a variable (varid): > >module Foo where >data T = _ThisWorksAlthoughItShouldNot >_ThisShouldWorkButItDoesNot = '?' > > A comment

-O2 == crash

2000-03-09 Thread Marcin 'Qrczak' Kowalczyk
The following code crashes when compiled with -O2. With -O it does not crash. Some trivial modifications make the crash go away. import Array(Array, array, (!)) import Random (StdGen, newStdGen) import MonadRWS (RWS(..