Proposal: Move primitive-Data.Primitive.Addr API into base

Carter Schonwald carter.schonwald at gmail.com
Sat Nov 3 12:49:27 UTC 2018


That’s not a bad design pattern. I think eds struct Lib is sortah similar
to that.

On Sat, Nov 3, 2018 at 2:56 AM Henning Thielemann <
lemming at henning-thielemann.de> wrote:

>
> On Fri, 26 Oct 2018, Henning Thielemann wrote:
>
> > There are the Storable methods
> >
> > peekByteOff :: Ptr b -> Int -> IO a
> > pokeByteOff :: Ptr b -> Int -> a -> IO ()
> >
> > They ignore the target types of their pointers. Should be Addr, then,
> too?
>
> Thinking about it ... these functions are intended for access of record
> fields. Then the following type signatures would have been better:
>
> peekField :: Ptr b -> Offset b a -> IO a
> pokeField :: Ptr b -> Offset b a -> a -> IO ()
>
> newtype Offset b a = Offset Int
>
> This way we had more type safety and no need for Addr or lying Ptr's.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20181103/96a5389a/attachment.html>


More information about the Libraries mailing list