Proposal: Don't require users to use undefined

Simon Marlow marlowsd at gmail.com
Thu Oct 28 07:55:21 EDT 2010


On 27/10/2010 08:43, Simon Peyton-Jones wrote:
> | Users of the sizeOf or alignment methods (:: a ->  Int) of the Storable
> | class are pushed to use 'undefined' in their programs. Take the
> | following function from Foreign.Marshal.Alloc as an example:
> |
> | malloc :: Storable a =>  IO (Ptr a)
> | malloc  = doMalloc undefined
> |   where
> |     doMalloc       :: Storable b =>  b ->  IO (Ptr b)
> |     doMalloc dummy  = mallocBytes (sizeOf dummy)
> |
> ...
> |
> | I would like to propose solving this. My proposal consists of 3 sub-proposals:
>
> I'm not keen on this proposal.
>    a) The improvement is minor
>    b) A lot of exixting code has to be changed
>    c) There is a better way to do the job

Agree.

Simon


More information about the Libraries mailing list