[Haskell-beginners] let x = x in x (GHC.Prim)

John Ky newhoggy at gmail.com
Tue Mar 22 23:10:09 UTC 2016


Hello Haskellers,

I'm trying to write a faster popCount function for x86 systems.

I tried cloning the ghc-prim package and repurposing it for my own needs,
but it isn't working as hoped.

In particular, popCnt64# was implemented in GHC.Prim as:

popCnt64# = let x = x in x

Which shouldn't terminate.  Yet when I call it, it magically finds the C
implementation in hs_popcnt64 and returns the correct value.

My cloned project doesn't behave that way.  Instead it doesn't terminate as
I would expect.

Anyone know what's happening here, if there is a way to make this work or
tell me if I'm going about this completely the wrong way?

Cheers,

-John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160322/f79083e0/attachment.html>


More information about the Beginners mailing list