id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
7619	Make worker-wrapper unbox data families	akio	simonpj	"I noticed that the worker-wrapper optimization doesn't unbox arguments whose type is a data family instance. For example in this module:

{{{
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE BangPatterns #-}
module Foo where
data family Foo a

data instance Foo Int = FooInt Int Int

foo :: Foo Int -> Int
foo (FooInt a b) = loop a b
    where
        loop 0 y = length $ replicate y b
        loop x !y = loop (mod y x) x

foo1 :: (Int, Int) -> Int
foo1 (a, b) = loop a b
    where
        loop 0 y = length $ replicate y b
        loop x !y = loop (mod y x) x
}}}

foo and foo1 both get worker-wrapper applied, with worker functions of the following types:

{{{
$wfoo :: Foo Int -> Int#
$wfoo1 :: Int# -> Int# -> Int#
}}}

It would be nice if $wfoo could get the same type as $wfoo1.

This issue happened in real life with unboxed vectors from the vector package, resulting in a lot of boxing with unboxed vector constructors immediately followed by unboxing."	feature request	new	normal	7.8.1	Compiler	7.7		type family	jwlato@… hackage.haskell.org@…	Unknown/Multiple	Unknown/Multiple	None/Unknown	Unknown				
