X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fusers_guide%2Fglasgow_exts.sgml;fp=ghc%2Fdocs%2Fusers_guide%2Fglasgow_exts.sgml;h=2a7f379bfa8db15a3c4d5849efabf9739175eaa0;hb=93297f092a1d99f97e43d0cd8a666668c1af2dda;hp=b51278be86169ac537796d47ff88b3593d660ecb;hpb=fb329e13b82436ceaf4392da4cf90d69abf6bbf8;p=ghc-hetmet.git diff --git a/ghc/docs/users_guide/glasgow_exts.sgml b/ghc/docs/users_guide/glasgow_exts.sgml index b51278b..2a7f379 100644 --- a/ghc/docs/users_guide/glasgow_exts.sgml +++ b/ghc/docs/users_guide/glasgow_exts.sgml @@ -4250,12 +4250,12 @@ of the pragma. UNPACK pragma - UNPACK + UNPACK - There is another use for the UNPACK - pragma: to indicate that the compiler should unpack the contents - of a constructor field into the constructor itself, removing a - level of indirection. For example: + The UNPACK indicates to the compiler + that it should unpack the contents of a constructor field into + the constructor itself, removing a level of indirection. For + example: data T = T {-# UNPACK #-} !Float @@ -4300,7 +4300,12 @@ data S = S {-# UNPACK #-} !Int {-# UNPACK #-} !Int will store two unboxed Int#s - directly in the T constructor. + directly in the T constructor. The + unpacker can see through newtypes, too. + + If a field cannot be unpacked, you will not get a warning, + so it might be an idea to check the generated code with + . See also the flag, which essentially has the effect of adding