Skip to content
  • Ryan Scott's avatar
    Split out inferConstraintsDataConArgs from inferConstraints · a4f347c2
    Ryan Scott authored
    Summary:
    Addresses point (1) of https://phabricator.haskell.org/D3337#107865.
    
    Before, `inferConstraints` awkwardly combined all of the logic needed to handle
    stock, newtype, and anyclass deriving. Really, though, the stock/newtype logic
    is quite different from the anyclass logic, so this splits off
    `inferConstraintsDataConArgs` (so named because it infers constraints by
    inspecting the types of the arguments to data constructors) from
    `inferConstraints` to handle the stock/newtype-specific bits.
    
    Aside from making the code somewhat clearer, this allows us to factor out
    superclass constraint inference, which is done regardless of deriving strategy.
    
    Test Plan: If it builds, ship it
    
    Reviewers: bgamari, austin
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3827
    a4f347c2