#5659: hsc2hs should add explicit type annotations to peeks and pokes
------------------------------------------+---------------------------------
Reporter: ezyang | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: hsc2hs | Version: 7.0.2
Resolution: wontfix | Keywords:
Testcase: | Blockedby:
Difficulty: | Os: Unknown/Multiple
Blocking: | Architecture: Unknown/Multiple
Failure: GHC accepts invalid program |
------------------------------------------+---------------------------------
Comment(by ezyang):
Keegan and I had a brief discussion about this, and we think that one
fundamental issue here is that Int really shouldn't be in Storable, in the
sense that it doesn't have reasonable portability semantics (even on the
same machine) for C code. So you could instead have
{{{
class Storable a where ... -- as now
class (Storable a) => CStorable a -- no body
}}}
where CStorable instances are proofs that the type corresponds directly to
a specific C type. This won't save you if you mix up your types too much,
but avoids Int/CInt heartache.
Perhaps we could also permit people to more easily explicitly specify the
type of peeks and pokes, maybe as an extra optional arg (you can do it by
hand but it's kind of annoying in do-notation).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5659#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs