• Ryan Scott's avatar
    Fix derived Ix instances for one-constructor GADTs · 7b7ea8f4
    Ryan Scott authored
    Summary:
    Standalone-derived `Ix` instances would panic on GADTs with exactly
    one constructor, since the list of fields was being passed to a function that
    uses `foldl1` in order to generate an implementation for `inRange`. This adds a
    simple check that makes `inRange` be `True` whenever a product type has no
    fields.
    
    Fixes #12583.
    
    Test Plan: make test TEST=12583
    
    Reviewers: simonpj, austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2521
    
    GHC Trac Issues: #12583
    7b7ea8f4
TcGenDeriv.hs 118 KB