Newtype wrappers

Stephen Paul Weber singpolyma at singpolyma.net
Mon Jan 14 20:47:38 CET 2013


Somebody claiming to be Simon Peyton-Jones wrote:
>  *   For x1 we can write map MkAge x1 :: [Age]. But this does not follow 
>  the newtype cost model: there will be runtime overhead from executing the 
>  map at runtime, and sharing will be lost too. Could GHC optimise the map 
>  somehow?

My friend pointed out something interesting:

If GHC can know that MkAge is just id (in terms of code, not in terms of 
type), which seems possible, and if the only interesting case is a Functor, 
which seems possible, then a RULE fmap id = id would solve this.  No?

-- 
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20130114/90f93ae9/attachment.pgp>


More information about the Glasgow-haskell-users mailing list