Skip to content
  • Sylvain Henry's avatar
    a98593f0
    Refactor numeric constant folding rules · a98593f0
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    Avoid the use of global pattern synonyms.
    
    1) I think it's going to be helpful to implement constant folding for
       other numeric types, especially Natural which doesn't have a wrapping
       behavior. We'll have to refactor these rules even more so we'd better
       make them less cryptic.
    
    2) It should also be slightly faster because global pattern synonyms
       matched operations for every numeric types instead of the current one:
       e.g., ":**:" pattern was matching multiplication for both Int# and
       Word# types. As we will probably want to implement constant folding
       for other numeric types (Int8#, Int16#, etc.), it is more efficient
       to only match primops for a given type as we do now.
    a98593f0
    Refactor numeric constant folding rules
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    Avoid the use of global pattern synonyms.
    
    1) I think it's going to be helpful to implement constant folding for
       other numeric types, especially Natural which doesn't have a wrapping
       behavior. We'll have to refactor these rules even more so we'd better
       make them less cryptic.
    
    2) It should also be slightly faster because global pattern synonyms
       matched operations for every numeric types instead of the current one:
       e.g., ":**:" pattern was matching multiplication for both Int# and
       Word# types. As we will probably want to implement constant folding
       for other numeric types (Int8#, Int16#, etc.), it is more efficient
       to only match primops for a given type as we do now.
Loading