Hi! I thought refineDefaultAlt was about scenarios like this:
data D = C0 | C1 | C2 case e of DEFAULT -> e0 C0 -> e1 C1 -> e1 When we apply combineIdenticalAlts to this expression, it can't combine the alts for C0 and C1, as we already have a default case. If we apply refineDefaultAlt first, we get case e of C0 -> e1 C1 -> e1 C2 -> e0 and combineIdenticalAlts can turn that into case e of DEFAULT -> e1 C2 -> e0 But that's just my own interpretation and possibly not the original motivation. Cheers, Simon 2018-05-11 17:03 GMT+02:00 Simon Peyton Jones via ghc-devs <[email protected]>: > Because if e contains > > …(case x of Foo p q -> e2)… > > as a sub-expression, we’d like to simplify it. > > > > Sorry that is not documented; please do add that to the comments in the > source code. > > > > Simon > > > > From: ghc-devs <[email protected]> On Behalf Of Matthew Pickering > Sent: 11 May 2018 15:54 > To: GHC developers <[email protected]> > Subject: Motivation for refineDefaultAlt > > > > Hi all, > > > > Does anyone know the motivation for refineDefaultAlt? > > The comment states > > - -- | Refine the default alternative to a 'DataAlt', if there is a unique > way to do so. > > OK - so the code transforms something like > > case x of { DEFAULT -> e } > ===> > > case x of { Foo a1 a2 a3 -> e } > > > but why is this necessary or desirable? > > Perhaps you know Simon (Jakobi)? > > Cheers, > > > > Matt > > > > > _______________________________________________ > ghc-devs mailing list > [email protected] > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > _______________________________________________ ghc-devs mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
