
18 Dec
2009
18 Dec
'09
7:16 p.m.
Hey everyone, 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. I can see what's going on: it can't tell that the "a" I am writing there is the same "a" that's in the type specification, but is there any way that I can make it identify "a" with the "a" in the specification for nextPtr? Cheers, Greg