[Hs-Generics] Re: Splitting SYB from the base package in GHC 6.10
José Pedro Magalhães
jpm at cs.uu.nl
Mon Sep 15 07:28:30 EDT 2008
Hello,
On Wed, Sep 3, 2008 at 13:50, Simon Peyton-Jones <simonpj at microsoft.com>wrote:
> My reading of Claus's message is that, modulo discussion of some details of
> [partial], he'd go with that plan.
>
> Is that acceptable to others? If so, someone (Jose) needs to sort out the
> details. 19 Sept is GHC's release candidate, so we need this done well
> before then.
Are the details sorted out? Summarizing:
- Data.Generics.Basics stays in base;
- All other SYB modules besides Data.Generics.Instances go into a new
'syb' package;
- Data.Generics.Instances is split in two, one part remaining in base and
the other moving to the syb package.
Regarding the instances, two aspects have to be considered:
1. Avoiding the implicit re-export of Data instances from modules in
base;
2. Deciding which instances go where.
Regarding (1), the following changes need to be done:
- Ratio has to be fixed to have a consistent instance: either it's seen
as an abstract datatype (therefore with undefined gunfold) or a gfoldl has
to be defined matching its gunfold;
- Complex should have its derived instance restored (or otherwise a
manual instance with a proper gfoldl);
- Other places that have to be changed:
- The Data instance of Data.Array should be moved from
Data.Generics.Instances into Array, to avoid syb dependency;
- The imports of SYB in the following modules should be fixed to avoid
bringing into scope all the instances:
./containers/Data/IntMap.hs
./containers/Data/IntSet.hs
./containers/Data/Map.hs
./containers/Data/Sequence.hs
./containers/Data/Set.hs
./containers/Data/Tree.hs
./network/Network/URI.hs
./packedstring/Data/PackedString.hs
- The following modules use of Ratio instances, which is not problematic
if the instance for Ratio is fixed. Therefore no change is needed here:
./haskell-src/Language/Haskell/Syntax.hs
./template-haskell/Language/Haskell/TH/Quote.hs
./template-haskell/Language/Haskell/TH/Syntax.hs
- These modules depend on an instance for ForeignPtr Word8. Instances for
types with phantom types stay in base, since no suitable instance can be
given (see (2) below). Therefore no change is needed here:
./bytestring/Data/ByteString/Internal.hs
./bytestring/Data/ByteString/Lazy/Internal.hs
Regarding (2), the separation of the 44 Data instances in
Data.Generics.Instances is the following:
- These 26 [standard] instances are uncontroversial and can accompany the
Data class:
[a] (Maybe a) (Either a b) () (,) (,,) (,,,) (,,,,) (,,,,,) (,,,,,,)
Bool Ordering Char Double Float Integer
Int Int8 Int16 Int32 Int64 Word Word8 Word16 Word32 Word64
- These 2 instances could also be [standard] and stay in base, after
fixing (see (1) above):
Ratio Complex
- These 2 instances have phantom types. No good suggestion for what to do
with them has shown up, therefore they stay in base as they are:
Ptr ForeignPtr
- These 6 instances have abstract datatypes. Unless there is some reason
to keep them in base, I suggest they go into the syb package:
DataType TyCon TypeRep Handle ThreadId StablePtr
- These 7 go in the syb package for future discussion:
(a -> b) (IO a) (ST s a) (STM a) (IORef a) (TVar a) (MVar a)
- The instance for Array is moved into Data.Array.
Any remarks?
Thanks,
Pedro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/generics/attachments/20080915/19a7e702/attachment.htm
More information about the Generics
mailing list