• Joachim Breitner's avatar
    Further simplify the story around minimum/maximum · c6b82e99
    Joachim Breitner authored
    After I have found out that I should look at -ddump-prep and not
    -ddump-core, I noticed that these days, GHC is perfectly capeable of
    turning (the equivalent) of foldl to (the equivalent) of foldl' if the
    operation in question is strict. So instead of using rewrite rules to
    rewrite maximum to a strictMaximum for certain types, we simply use
    SPECIALIZE.
    
    This also marks maximum/minimum as INLINEABLE, so that client code can
    get similar specializations, hopefully even automatically. And inded,
    minimum applied to [Double] produces good code (although due to
    inlineing, not due to specialization, it seems).
    
    I checked (by looking at the core) that this still fixes #10788.
    
    Differential revision: https://phabricator.haskell.org/D1229
    c6b82e99
List.hs 33.6 KB