Changes between Version 9 and Version 10 of PrimBool


Ignore:
Timestamp:
Feb 8, 2013 1:12:18 PM (2 years ago)
Author:
jstolarek
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PrimBool

    v9 v10  
    235235== Places of interest in the source code ==
    236236
    237 The file [[GhcFile(prelude/primops.txt.pp)]] defines !PrimOps and their type signatures.
     237The file [[GhcFile(prelude/primops.txt.pp)]] defines !PrimOps and their type signatures. An example definition looks like this:
     238
     239{{{
     240primop   IntGtOp  ">#"   Compare   Int# -> Int# -> Bool
     241   with fixity = infix 4
     242}}}
     243
     244Existing definitions should remain unchanged or the code using them would break and that is a Very Bad Thing. This would require creating new !PrimOps:
     245
     246{{{
     247primop   IntGtOpB  ".>#"   Compare   Int# -> Int# -> Bool#
     248   with fixity = infix 4
     249}}}
     250
     251The tricky part here is `Compare`. This a value constructor of `PrimOpInfo` data type defined in [[GhcFile(prelude/PrimOp.lhs)]]:
     252
     253{{{
     254data PrimOpInfo
     255  = Dyadic      OccName         -- string :: T -> T -> T
     256                Type
     257  | Monadic     OccName         -- string :: T -> T
     258                Type
     259  | Compare     OccName         -- string :: T -> T -> Bool
     260                Type
     261  | GenPrimOp   OccName         -- string :: \/a1..an . T1 -> .. -> Tk -> T
     262                [TyVar]
     263                [Type]
     264                Type
     265}}}
     266
     267We would need new `PrimOpInfo` value to denote !PrimOps of type `T -> T -> Bool#`. Appropriate functions like `primOpSig` and `getPrimOpResultInfo` would have to be adjusted accordingly.