{-# LANGUAGE MagicHash #-} {-# OPTIONS_GHC -frewrite-rules #-} {-# OPTIONS_GHC -ddump-rule-rewrites #-} {-# OPTIONS_GHC -ddump-rules #-} {-# OPTIONS_GHC -dcore-lint #-} {-# OPTIONS_GHC -ddump-simpl #-} module ConCatRules where import GHC.Prim import GHC.Int boxI :: Int# -> Int boxI = I# {-# INLINE [0] boxI #-} unboxI :: Int -> Int# unboxI (I# i#) = i# -- {-# INLINE [0] unboxI #-} plus :: Int -> Int -> Int plus x y = undefined {-# NOINLINE plus #-} {-# RULES "reboxa" forall u# v# . (+#) u# v# = unboxI (plus (boxI u#) (boxI v#)) "reboxb" forall u# . (+#) u# = \v# -> unboxI (plus (boxI u#) (boxI v#)) "reboxc" (+#) = \ u# v# -> unboxI (plus (boxI u#) (boxI v#)) #-} foo = I# (10# +# 1#)