Sean Leather wrote:
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?


Lexically scoped type variables:
http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#scoped-type-variables

And if you require H98+FFI only, you can also use the following:

    ptrSizeOf = sizeOf . asTypeOf undefined . unsafePerformIO . peek

The asTypeOf function is the H98 way of handling many scoped type variable issues. It never evaluates its second argument so the unsafePerformIO is perfectly safe since the peek will never be evaluated either (and, heck, the whole argument to sizeOf won't be evaluated either).

--
Live well,
~wren
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to