Re: Request: withArrayLength
Adrian Hey <[email protected]> Mon, 29 Mar 2004 09:13:09 +0100
| Newsgroups | gmane.comp.lang.haskell.ffi |
|---|---|
| Message-ID | <[email protected]> |
On Monday 29 Mar 2004 8:35 am, Sven Panne wrote: > I wrote: > > [...] So if nobody yells, I'll add > > > > withArrayLen :: Storable a => [a] -> (Ptr a -> Int -> IO b) -> > > IO b withArrayLen0 :: Storable a => a -> [a] -> (Ptr a -> Int -> IO b) -> > > IO b [...] > > After some thoughts, swapping the order of the pointer and the length, > i.e.: > > withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO > b withArrayLen0 :: Storable a => a -> [a] -> (Int -> Ptr a -> IO b) -> IO b > > might be nicer, because then we had the nice property: > > withArrayLen x peekArray == x > > Opinions? Well I can't forsee any circumstances where I would be likely to do that :-), but it seems sensible to be consistent about order of Int and Ptr arguments, as you suggest. Regards -- Adrian Hey