Stealing ideas from the latest GCC release

John Meacham john at repetae.net
Fri Mar 23 00:16:02 CET 2012


I support a form of this in jhc by allowing specialization of values,
not just types.
It is actually the same mechanism as type specialization since that is
just value specialization where the value being specialized on is the
type parameter.

foo :: Bool -> Int

{-# SPECIALIZE foo True :: Int #-}
(I think this is the current syntax, I changed it a couple times in
jhc's history)

will create a

foo_True :: Int
foo_True = inline foo True

and a

{-# RULE foo True = foo_True #-}

   John



More information about the Glasgow-haskell-users mailing list