Re: [GHC] #5659: hsc2hs should add explicit type annotations to peeks and pokes

2011-12-14 Thread GHC
#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:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  GHC accepts invalid program  | Difficulty:  
  Testcase:   |  Blockedby:  
  Blocking:   |Related:  
--+-
Changes (by PHO):

 * cc: pho@… (added)


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5659#comment:3
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #5659: hsc2hs should add explicit type annotations to peeks and pokes

2011-11-26 Thread GHC
#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
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #5659: hsc2hs should add explicit type annotations to peeks and pokes

2011-11-25 Thread GHC
#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  |  
--+-
Changes (by igloo):

  * status:  new = closed
  * resolution:  = wontfix


Comment:

 You mean the correct code is this, right?:
 {{{
   c_len   - #{peek ZNotice_t, z_message_len} c_note
   c_msg   - #{peek ZNotice_t, z_message} c_note
   message - B.packCStringLen (c_msg, fromIntegral (c_len :: CInt))
 }}}

 I don't think there's anything we can do. You can `peek` anything that is
 `Storable`, and while that does have a `sizeof` method I don't see a
 reasonable way for `hsc2hs` to call it with the right type.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5659#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs