Simon Marlow  warned  (i do not know whether the docs mentions this)

that   deriving (...) 

can be very expensive for compiling with  ghc-4.02
- especially, for  Show, Read.

Now, comparing

  data CategoryName =
       Set | AddSemigroup | AddGroup | MulSemigroup | MulGroup 
       | Ring | LinSolvRing | GCDRing | FactorizationRing 
       | EuclideanRing | IdealKey | LeftModule | LinSolvLModule

       deriving (Show) 


and the same - with `deriving' replaced with the explicit instance

  instance Show CategoryName
    where
    showsPrec _ x = case x of
                          Set               -> (" Set "++)
                          AddSemigroup      -> (" AddSemigroup "++)
                          ...


shows that  `deriving' gives 1.5 times smaller code.

And i really need here  Eq, Ord, Enum, Show  - they are not dummies.

Looks like it is better for me to derive them.

And the Simon's warning is for remembering that the effect is about as
if one sets these instances manually.

Do i understand correct?


------------------
Sergey Mechveliani
[EMAIL PROTECTED]

Reply via email to