Skip to content
  • David Feuer's avatar
    Derive the definition of null · bf5e0eab
    David Feuer authored
    We can sometimes produce much better code by deriving the
    definition of `null` rather than using the default. For example,
    given
    
        data SnocList a = Lin | Snoc (SnocList a) a
    
    the default definition of `null` will walk the whole list, but of
    course we can stop as soon as we see `Snoc`. Similarly, if a
    constructor contains some other `Foldable` type, we want to use its
    `null` rather than folding over the structure.
    
    Partially fixes Trac #13280
    
    Reviewers: austin, bgamari, RyanGlScott
    
    Reviewed By: RyanGlScott
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3402
    bf5e0eab