Haskell 2010: libraries

Manuel M T Chakravarty chak at cse.unsw.edu.au
Sat Jul 11 06:54:14 EDT 2009


Ross Paterson:
> On Wed, Jul 08, 2009 at 03:09:29PM +0100, Simon Marlow wrote:
>> 1. Just drop the whole libraries section from the report.  The
>>    Report will still define the Prelude, however.
>>
>>    There will be some loose ends where the rest of the report
>>    refers to entities from these libraries, e.g. the Prelude
>>    refers to Rational from the Ratio library.  We just have to
>>    fix up these references, moving the appropriate definitions
>>    into the Report as necessary.
>
> Some of the loose ends:
>
> The defaulting rules (section 4.3.4) apply to any class "defined in  
> the
> Prelude or a standard library".  The non-Prelude classes involved are
> Ix and Random.
>
> The FFI spec refers to types Int8, Int16, Int32, Int64, Word8, Word16,
> Word32, Word64, Ptr a, FunPtr a and StablePtr a.  Perhaps they  
> should move
> to the Prelude when the non-library part of the FFI spec is  
> incorporated
> into the Report?

If we have these types in the Prelude, the associated functions should  
be in the Prelude, too, and I'd be reluctant to include operations  
that are not memory-safe in the Prelude.  So, I think, we need at  
least a standard library for the FFI.  (In the FFI spec, we after all  
went to a lot of trouble to realise as much as possible of the needed  
functionality as libraries, to change the core language as little as  
possible.)

I understand the desire to cut down on the number of library functions  
defined in the report, but ultimately, the language needs to provide a  
basic set of functionality that is the basis for implementing all the  
other libraries.  Otherwise, the usefulness of the standard gets  
undermined.

Apart from the Prelude, I think we should ask the following question  
to decide whether we can omit some library functionality from the  
language definition:

   If we omit the functionality under consideration,
   can we implement it in a portable manner with what remains in the  
definition?

If that is not the case, we ought to include it.

Manuel

PS: As a historical anecdote, it was a major shortcoming of Modula-2  
over C that Modula-2 didn't define it's basic libraries properly with  
the language (whereas C did).


More information about the Haskell-prime mailing list