[Haskell-cafe] sizeOf on a type
Henning Thielemann
lemming at henning-thielemann.de
Thu Jan 14 12:51:55 EST 2010
On Fri, 25 Dec 2009, Lennart Augustsson wrote:
> sizeOfPtr :: Ptr a -> Int
> sizeOfPtr = sizeOf . (undefined :: Ptr a -> a)
>
> No need for scoped type variables. But it does assume sizeOf does not
> use its argument.
That's even better. I'll add that to the Wiki.
http://www.haskell.org/haskellwiki/Scoped_type_variables#Avoiding_Scoped_Type_Variables
More information about the Haskell-Cafe
mailing list