[Haskell-cafe] sizeOf on a type
gcross at phys.washington.edu
Fri Dec 18 17:03:18 EST 2009
Yay, advancePtr is exactly what I needed! I totally missed that one in the docs.
Also thanks to those of you who pointed me to the scoped type variables feature, since I had figured that a feature liked that had to exist but I just didn't know where to look for it.
You guys rock!
On Dec 18, 2009, at 12:09 PM, Patai Gergely wrote:
>> I would like to write a routine like
>> nextPtr :: Storable a => Ptr a -> Ptr a
>> nextPtr = (`plusPtr` sizeOf (undefined :: a))
>> which increments a pointer by the correct amount, but
>> GHC complains that the type variable "a" is ambiguous.
> Maybe Foreign.Marshal.Array.advancePtr is what you really need in this
> http://www.fastmail.fm - The professional email service
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe