Given:
newtype MyVec = MyVec { unVec :: Data.Vector }
deriving (Functor, etc)
This will create (something like) this:
instance Functor MyVec where
fmap f = MyVec . Data.Vector.fmap f . unVec
Will Vectors fusion rules fire and rewrite fmap f . fmap g $ myVec
into fmap (f . g) myVec
?
Are there any pitfalls I should be aware of? Afaik the problem where you "pay" for new types in containers was solved in GHC 7.8, was it?
newtype
s cost nothing". Shouldn't it be reworded if it is indeed the case that they prevent some optimizations? – Sideline