desperately seeking RULES help

Johan Tibell johan.tibell at
Sat Jun 7 06:37:17 EDT 2008

2008/6/7 Conal Elliott <conal at>:
> I'm trying to do some fusion in ghc, and I'd greatly appreciate help with
> the code below (which is simplified from fusion on linear maps).  I've tried
> every variation I can think of, and always something prevents the fusion.
> [snip]
> {-# INLINE onInt #-}
> onInt :: AsInt a => (Int -> Int) -> (a -> a)
> onInt f = fromInt . f . toInt

I don't know if this will help but add this to prevent GHC from
inlining the definition of fromInt (or toInt) in the first phase:

{-# NOINLINE [1] fromInt #-}
{-# INLINE [2] fromInt #-}

It might be possible to combine the both into one pragma but I don't know how.

-- Johan

More information about the Glasgow-haskell-users mailing list