
Hi Marcin,
That explanation helps. Thanks!
-John
On Tue, 22 Mar 2016 at 18:25 Marcin Mrotek
Hi,
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#.
If you wanted to stay in GHCi, you can do it like:
Prelude> import GHC.Prim Prelude GHC.Prim> import GHC.Types Prelude GHC.Prim GHC.Types> :set -XMagicHash Prelude GHC.Prim GHC.Types> :t W# W# :: Word# -> Word Prelude GHC.Prim GHC.Types> :t popCnt64# popCnt64# :: Word# -> Word# Prelude GHC.Prim GHC.Types> let foo = (1 :: Word) Prelude GHC.Prim GHC.Types> :set -XBangPatterns Prelude GHC.Prim GHC.Types> let !(W# w) = foo in W# (popCnt64# w) 1
Best regards, Marcin Mrotek _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners