[Haskell-cafe] bytestring vs. uvector

Don Stewart dons at galois.com
Tue Mar 10 17:12:47 EDT 2009


xj2106:
> Don Stewart <dons at galois.com> writes:
> 
> > And what is Storable limited to?
> >
> > Ultimately they're all limited to the primops for reading and writing,
> > and to what types we can encode in those. So:
> >
> >     primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp
> >     ...
> > {-
> > instance Storable Double
> > instance Storable Bool
> > instance Storable Char
> > instance Storable Int
> > instance Storable Float
> > ...
> > -}
> >
> > {-
> >
> > instance UA ()
> > instance (UA a, UA b) => UA (a :*: b)
> > instance UA Bool
> > instance UA Char
> > instance UA Int
> > instance UA Float
> > instance UA Double
> > ...
> > -}
> >
> > So what's a type that's Storable, but not writable in UA (or UArray or ..)
> 
> So it's me who understand it wrong.  If I want some high
> performance array with elements of custom data type, I'm
> stuck with Array, anyway?
> 
> Is it possible to make
> 
> instance UA UserDefinedDataType
> 
> I'm not sure how to do that.  Can you give me some
> clarification?

Yes, you can do that. This is the case for most of the new array
libraries.

-- Don


More information about the Haskell-Cafe mailing list