[GHC] #8299: Add richer data model address arithmetic: AddrDiff and AddrInt (ie d Int_ptr_diff and Int_ptr_size)

GHC ghc-devs at haskell.org
Thu Sep 19 19:51:27 CEST 2013


#8299: Add richer data model address arithmetic: AddrDiff and AddrInt (ie d
Int_ptr_diff and Int_ptr_size)
----------------------------+----------------------------------------------
        Reporter:  carter   |            Owner:
            Type:  feature  |           Status:  new
  request                   |        Milestone:  7.10.1
        Priority:  high     |          Version:  7.6.3
       Component:           |         Keywords:
  Compiler                  |     Architecture:  Unknown/Multiple
      Resolution:           |       Difficulty:  Project (more than a week)
Operating System:           |       Blocked By:
  Unknown/Multiple          |  Related Tickets:
 Type of failure:           |
  None/Unknown              |
       Test Case:           |
        Blocking:  8287     |
----------------------------+----------------------------------------------

Comment (by carter):

 @simon I think so! (though i could be wrong). I'll have to mull over it a
 bit as I have time

 on the associated api: would motivate adding Torsors to GHC Base I think.
 http://www.reddit.com/r/haskell/comments/166iju/subtractable_values_are_torsors/

 http://ro-che.info/articles/2013-01-08-torsors.html
 and

 http://hackage.haskell.org/packages/archive/vector-space/latest/doc/html
 /Data-AffineSpace.html

 with the key bits being

 {{{
 class AdditiveGroup (Diff p) => AffineSpace p whereSource

 Associated Types
 type Diff p Source

 Associated vector space

 Methods
 (.-.) :: p -> p -> Diff pSource

 Subtract points

 (.+^) :: p -> Diff p -> pSource

 Point plus vector

 }}}

 in this case, the Addr would the the "points", and the offset type   would
 be type Diff Addr = AddrDiff

 or something like that.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8299#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list