default declarations

Simon Peyton-Jones simonpj at microsoft.com
Mon Aug 7 05:28:30 EDT 2006


It's arguably a bug in ghci -- but it's not quite clear what the "right"
answer is.  Suppose you are in the top level scope of two modules with
differing default declarations.  So GHCi uses the "default default" for
the top level, always.  

Simon

| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org
[mailto:glasgow-haskell-users-bounces at haskell.org]
| On Behalf Of Daniel Fischer
| Sent: 06 August 2006 01:11
| To: GHC Users
| Subject: default declarations
| 
| Hi,
| 
| apparently ghci doesn't take default declarations into account.
| Inspired by a question on the hugs-users list I wrote
| 
| module BoolNum where
| 
| default (Bool, Rational)
| 
| instance Num Bool where
|     (+) = (/=)
|     (-) = (/=)
|     (*) = (&&)
|     negate x = x
|     abs x = x
|     signum x = x
|     fromInteger = odd
| 
| 
| and in hugs, as expected I get
| BoolNum> 1
| True
| 
| but in ghci, it's
| *BoolNum> 1
| 1,
| 
| no defaulting apparently takes pkace.
| 
| Why?
| 
| Bug or feature ?
| 
| Cheers, Daniel
| --
| 
| "In My Egotistical Opinion, most people's C programs should be
| indented six feet downward and covered with dirt."
| 	-- Blair P. Houghton
| 
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list