Skip to content
  • Simon Peyton Jones's avatar
    Extensive Notes on can_fail and has_side_effects · ab6480b8
    Simon Peyton Jones authored
    In fixing Trac #9390 I discovered that I *still* didn't really understand
    what the can_fail and has_side_effects properties of a PrimOp mean, precisely.
    
    The big new things I learned are
    
    * has_side_effects needs to be true only of *write* effects,
      Reads (which are, strictly speaking, effects) don't matter here.
    
    * has_side_effects must be true of primops that can throw a synchronous
      Haskell exception (eg raiseIO#)
    
    * can_fail is true only of primops that can cause an *unchecked* (not
      Haskell) system exception, like divide by zero, or accessing memory
      out of range through an array read or write.
    
    I've documented all this now.  The changes in this patch are only
    in comments.
    ab6480b8