Skip to content
  • Hannes Siebenhandl's avatar
    Add Eq and Ord instance to `IfaceType` · b2227487
    Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
    We add an `Ord` instance so that we can store `IfaceType` in a
    `Data.Map` container.
    This is required to deduplicate `IfaceType` while writing `.hi` files to
    disk. Deduplication has many beneficial consequences to both file size
    and memory usage, as the deduplication enables implicit sharing of
    values.
    See issue #24540 for more motivation.
    
    The `Ord` instance would be unnecessary if we used a `TrieMap` instead
    of `Data.Map` for the deduplication process. While in theory this is
    clerarly the better option, experiments on the agda code base showed
    that a `TrieMap` implementation has worse run-time performance
    characteristics.
    
    To the change itself, we mostly derive `Eq` and `Ord`. This requires us
    to change occurrences of `FastString` with `LexicalFastString`, since
    `FastString` has no `Ord` instance.
    We change the definition of `IfLclName` to a newtype of
    `LexicalFastString`, to make such changes in the future easier.
    
    Bump haddock submodule for IfLclName changes
    b2227487