#6028: warning for cyclic unimplemented defaults
-------------------------------+--------------------------------------------
  Reporter:  lerkok            |          Owner:                  
      Type:  feature request   |         Status:  closed          
  Priority:  normal            |      Milestone:                  
 Component:  Compiler          |        Version:  7.4.1           
Resolution:  wontfix           |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |     Difficulty:  Unknown         
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------
Changes (by igloo):

  * status:  new => closed
  * difficulty:  => Unknown
  * resolution:  => wontfix


Comment:

 It's not quite that simple. The default implementations are:
 {{{
 negate x            = 0 - x
 x - y               = x + negate y
 }}}
 so actually (-) is defined in terms of (+), not negate. For example, if we
 have:
 {{{
 data X = C
     deriving Show

 instance Num X where
     _ + _ = C
 }}}
 then "-3 :: X" evaluates to C.

 It also wouldn't work for shift:
 {{{
 x `shift`   i | i<0       = x `shiftR` (-i)
               | i>0       = x `shiftL` i
               | otherwise = x

 x `shiftL`  i = x `shift`  i
 x `shiftR`  i = x `shift`  (-i)
 }}}

 I'm not convinced that there are many instances where this would actually
 help, so I'm closing the ticket.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6028#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to