[Haskell] base libraries

Ross Paterson ross at soi.city.ac.uk
Mon Nov 27 12:13:23 EST 2006

On Mon, Nov 27, 2006 at 02:42:18PM +0000, Malcolm Wallace wrote:
> Simon Marlow <simonmarhaskell at gmail.com> wrote:
> > > Answer: Hugs has a separate package 'hugs-base' with essential but
> > > implementation-dependent things like ForeignPtr in it.  (Likewise
> > > nhc98/yhc.)  The 'base' package just imports and uses it.
> > 
> > As I understand it, Hugs and nhc98 do this by having their own copies
> > of a lot  of the library code (up to and including the Prelude?).
> Yes.  Essentially, we took the view that the Haskell'98 libraries (+
> primitives + FFI) can be assumed, and then built the 'base' package on
> top of that.  Whereas GHC took the opposite approach, making 'base' the
> bottom of the hierarchy and building 'haskell98' on top of that.  Hence
> why lots of GHC-only primitives ended up in 'base', which is not good
> for a so-called portable package.

Hugs takes an intermediate approach, basically as described by Simon:
There's a copy of the Prelude (and parts of other modules that are
mutually recursive with it, and some other primitives); base is built on
that, and haskell98 on top of that.  So we share most of base (and all of
haskell98) with GHC.  The Hugs module system would allow the Prelude to
import other modules like Data.Maybe and System.IO, getting more sharing,
but since the whole thing will be interpreted each time Hugs starts,
we preferred to minimize the part under the Prelude.

There is some other duplication, notably large chunks of Numeric, due
to constraints on module relationships imposed by GHC's specialization

More information about the Libraries mailing list