Splitting SYB from the base package in GHC 6.10

José Pedro Magalhães jpm at cs.uu.nl
Thu Sep 4 03:44:34 EDT 2008


On Wed, Sep 3, 2008 at 13:57, Ross Paterson <ross at soi.city.ac.uk> wrote:

> Another attempt:
> These [standard] instances are uncontroversial and can accompany the
> Data class:
>    [] Maybe Either () tuples
>    Bool Ordering Char Double Float Integer
>     Int Int8 Int16 Int32 Int64 Word Word8 Word16 Word32 Word64
> These instances could also be [standard], after fixing:
>    Ratio Complex

So Ratio would have to be given a proper gfoldl definition, to fits its

gunfold k z c | constrIndex c == 1 = k (k (z (:%)))

Complex has a derived instance. In Data.Complex:

data (RealFloat a) => Complex a
  = !a :+ !a
        deriving (Eq, Show, Read, Data)
# else
        deriving (Eq, Show, Read)
# endif

Was there a problem with this?

Regarding the other places that have to be changed [1]:


The Data instance of Array should be moved from Data.Generics.Instances into
Array, to avoid syb dependency.


As far as I can see, these are not problematic, but the imports should be
fixed to avoid bringing into scope all the instances.


The use of Ratio instances here is not problematic if the instance for Ratio
is fixed?


These depend on an instance for ForeignPtr Word8. What to do here?
Reclassify instances for types with phantom types into "standard", since
there is nothing to traverse?

On Wed, Sep 3, 2008 at 13:23, Claus Reinke <claus.reinke at talk21.com> wrote:

> (*) of course, it would be nice if ghc's deriving mechanism was
> based on a derived instance specification in the module providing
> the class, rather than being hardcoded into the compiler itself;
> so even with 'Data' out of 'base', that part currently cannot be
> changed without updating ghc. or if class aliases allowed the
> generated old-style 'Data' instances to be re-interpreted as
> 'DataA' and 'DataB' instances.. but none of that is realistic for
> the current split decision.

I fully agree that the deriving mechanism should be customizable. That would
make generic programming in general much nicer in Haskell. However, I don't
think it's realistic to expect such changes for 6.10...


[1] http://article.gmane.org/gmane.comp.lang.haskell.libraries/9957
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20080904/887ac99d/attachment-0001.htm

More information about the Libraries mailing list