RE: Replacing the Prelude

2002-05-14 Thread Simon Peyton-Jones
Ashley writes | > I was hoping to do something similar for 'do' notation by redefining | > (>>), (>>=) etc., but unfortunately GHC is quite insistent | that 'do' notation quite specifically refers to GHC.Base.Monad Dylan replies | I'm surprised that ghc uses the fromInteger and fromRational

Re: Replacing the Prelude

2002-05-14 Thread Dylan Thurston
On Sun, May 12, 2002 at 09:31:38PM -0700, Ashley Yakeley wrote: > I have recently been experimenting writing code that replaces large > chunks of the Prelude, compiling with -fno-implicit-prelude. I notice > that I can happily redefine numeric literals simply by creating functions > called 'fro

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Ashley Yakeley
At 2002-05-14 03:57, Simon Marlow wrote: >It turns out that the compiler "bug" is really just the compiler being a >bit loose with the IO monad - it freely translates the original >definition of evaluate using 'seq' into the slightly less strict version >by pushing the 'seq' through the state lam

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Simon Marlow
> At 2002-05-14 02:58, Simon Marlow wrote: > > >I must admit I can't think of any compelling reasons for the change, > >other than the fact that this is functionality that we don't > have at the > >moment, and therefore might be useful. Opinions? > > I need a function that does this: > >

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Ashley Yakeley
At 2002-05-14 02:58, Simon Marlow wrote: >I must admit I can't think of any compelling reasons for the change, >other than the fact that this is functionality that we don't have at the >moment, and therefore might be useful. Opinions? I need a function that does this: evaluate :: a -> IO a

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Simon Marlow
> >This is bizarre: the definition of evaluate in Exception is > exactly the > >one you gave above, yet they behave differently. You may > have uncovered > >a compiler bug, I'll look into it. > > I might ask which is correct: according to the rules for seq, > "evaluate' > undefined" should b

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Ashley Yakeley
At 2002-05-14 02:24, Simon Marlow wrote: >This is bizarre: the definition of evaluate in Exception is exactly the >one you gave above, yet they behave differently. You may have uncovered >a compiler bug, I'll look into it. I might ask which is correct: according to the rules for seq, "evaluate'

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Simon Marlow
> At 2002-05-13 22:07, Ashley Yakeley wrote: > > >I've noticed something a bit unusual about Exception.catch. > > Curiously, the definition of Exception.evaluate given in the GHC > Libraries documentation sec. 5.12.3 is not that actually > implemented by > GHC. > > evaluate' :: a -> I

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Simon Marlow
> >The idea is > >that if you want to use Exceptions in their full glory, you: > ... > > import qualified Exception > > I've noticed something a bit unusual about Exception.catch. > It seems it > can't catch "return undefined" by itself. Consider these > values of type > "IO String": >

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Ashley Yakeley
At 2002-05-13 22:07, Ashley Yakeley wrote: >I've noticed something a bit unusual about Exception.catch. Curiously, the definition of Exception.evaluate given in the GHC Libraries documentation sec. 5.12.3 is not that actually implemented by GHC. evaluate' :: a -> IO a; evaluat