• thomasw's avatar
    Parenthesise TypeOperator in import hints · b5c94262
    thomasw authored
    When a constructor was mistakenly imported directly instead of as a
    constructor of a data type, a hint will be shown on how to correctly
    import
    it. Just like the constructor, the data type should be surrounded in
    parentheses if it is an operator (TypeOperator in this case).
    
    Instead of:
    
        error:
            In module ‘Data.Type.Equality’:
              ‘Refl’ is a data constructor of ‘:~:’
            To import it use
              ‘import’ Data.Type.Equality( :~:( Refl ) )
            or
              ‘import’ Data.Type.Equality( :~:(..) )
    
    Print:
    
        error:
            In module ‘Data.Type.Equality’:
              ‘Refl’ is a data constructor of ‘(:~:)’
            To import it use
              ‘import’ Data.Type.Equality( (:~:)( Refl ) )
            or
              ‘import’ Data.Type.Equality( (:~:)(..) )
    
    Test Plan: pass new test
    
    Reviewers: austin, bgamari, simonpj
    
    Reviewed By: simonpj
    
    Subscribers: simonpj, thomie
    
    Differential Revision: https://phabricator.haskell.org/D1093
    
    GHC Trac Issues: #10668
    b5c94262
all.T 5.33 KB