On Sep 12, 2014 2:35 PM, "Joachim Breitner" <m...@joachim-breitner.de>
wrote:
> I once experimented with a magic "oneShot :: (a -> b) -> (a -> b)"
> function, semantically the identity, but tell the compiler not to share
> the result of the computation. Using that in the definition of
> foldl-as-foldr, one can get the same effect as Call Arity, but a bit
> more reliable. I need to investigate if that solves the sumConcatInits
> problem.

One nice thing about this idea (which sounds like it must be related to the
"state hack", but is more explicit) is that it presumably applies also to
similar situations in the State and ST monads, when a state transformer is
only used once. Could you explain, perhaps, what compiler transformation
this enables, and how you implemented it? It would be nice if the compiler
could figure this out for itself, but I'm sure that's much too big a
project for 7.10, whereas making sure foldl, scanl, mapAccumL, foldM, sum,
etc., work really reliably seems important. And yes, I do think such a
thing would probably work for scanl and such, assuming GHC's analysis can
use the information properly—they're just state-transforming list producers.

David
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs

Reply via email to