[Haskell-cafe] getPtrSize works, but is annoying

Gregory Crosswhite gcross at phys.washington.edu
Fri Dec 18 14:20:15 EST 2009


Ugh, I figured out how to write code to do what I wanted, but it seems like an ugly solution:

	getPtrSize :: Ptr a -> Int
	getPtrSize = getFrom dummy
	  where
		getFrom :: a -> Ptr a -> Int
		getFrom dummy _ = sizeOf dummy

Any thoughts on a less ugly solution, or is this really the best that I can do?

Cheers,
Greg



More information about the Haskell-Cafe mailing list