<div dir="ltr">Hi Marcin,<div><br></div><div>That explanation helps. Thanks!</div><div><br></div><div>-John</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 22 Mar 2016 at 18:25 Marcin Mrotek <<a href="mailto:marcin.jan.mrotek@gmail.com">marcin.jan.mrotek@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi,<br><br></div>In general, the problem is that GHCi is attempting to call `show` on the results of expressions you type in, but `show` (like any other polymorphic function; though you can look into "levity polymorphism" if you want to know more) can only accept values of types of kind * (boxed, lifted) - so it can print Word, but not Word#.<br><br></div>If you wanted to stay in GHCi, you can do it like:<br><br>Prelude> import GHC.Prim<br>Prelude GHC.Prim> import GHC.Types<br>Prelude GHC.Prim GHC.Types> :set -XMagicHash<br>Prelude GHC.Prim GHC.Types> :t W#<br>W# :: Word# -> Word<br>Prelude GHC.Prim GHC.Types> :t popCnt64#<br>popCnt64# :: Word# -> Word#<br>Prelude GHC.Prim GHC.Types> let foo = (1 :: Word)<br>Prelude GHC.Prim GHC.Types> :set -XBangPatterns<br>Prelude GHC.Prim GHC.Types> let !(W# w) = foo in W# (popCnt64# w)<br>1<br><br></div>Best regards,<br></div>Marcin Mrotek<br></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>