Re: Fusing loops by specializing on functions with SpecConstr?

2020-03-29 Thread Sebastian Graf
Hi Alexis, I've been wondering the same things and have worked on it on and off. See my progress in https://gitlab.haskell.org/ghc/ghc/issues/855#note_149482 and https://gitlab.haskell.org/ghc/ghc/issues/915#note_241520. The big problem with solving the higher-order specialisation problem throug

Fusing loops by specializing on functions with SpecConstr?

2020-03-29 Thread Alexis King
Hi all, I have recently been toying with FRP, and I’ve noticed that traditional formulations generate a lot of tiny loops that GHC does a very poor job optimizing. Here’s a simplified example: newtype SF a b = SF { runSF :: a -> (b, SF a b) } add1_snd :: SF (String, Int) (String, Int)