Skip to content
  • niteria's avatar
    Create a deterministic version of tyVarsOfType · 2325bd4e
    niteria authored and Ben Gamari's avatar Ben Gamari committed
    I've run into situations where I need deterministic `tyVarsOfType` and
    this implementation achieves that and also brings an algorithmic
    improvement.  Union of two `VarSet`s takes linear time the size of the
    sets and in the worst case we can have `n` unions of sets of sizes
    `(n-1, 1), (n-2, 1)...` making it quadratic.
    
    One reason why we need deterministic `tyVarsOfType` is in `abstractVars`
    in `SetLevels`. When we abstract type variables when floating we want
    them to be abstracted in deterministic order.
    
    Test Plan: harbormaster
    
    Reviewers: simonpj, goldfire, austin, hvr, simonmar, bgamari
    
    Reviewed By: simonmar
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1468
    
    GHC Trac Issues: #4012
    2325bd4e