Hi, Am Donnerstag, den 09.03.2017, 15:21 +0000 schrieb Simon Peyton Jones via ghc-devs: > > +-- The "mapFB" rule optimises compositions of map and > > +-- the "mapFB/id" rule get rids of 'map id' calls. > > +-- (Any similarity to the Functor laws for [] is expected.) > > Yes, obviously. But did you have a use-case, or did you just to this > on principle? If you don't have this rule what goes wrong. You must > have had a proximate reason for adding it.
Just on principle. I saw "map id" in some code dump and thought that
this should not be there.
> Oh. And I've just realised that
> mapFB c id
> will turn into
> \x y. c x y
> as soon as you inline mapFB. So why do you need a RULE to do
> that? Why not leave it for the inliner?
Because we have to keep mapFB around to rewrite it back with this rule
"mapList" [1] forall f. foldr (mapFB (:) f) [] = map f
This is explained in Note [Inline FB functions] in GHC.List, which is
referenced from the
{-# INLINE [0] mapFB #-}
pragma.
Greetings,
Joachim
--
Joachim “nomeata” Breitner
[email protected] • https://www.joachim-breitner.de/
XMPP: [email protected] • OpenPGP-Key: 0xF0FBF51F
Debian Developer: [email protected]
signature.asc
Description: This is a digitally signed message part
_______________________________________________ ghc-devs mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
