[Haskell-cafe] Using unboxed integers
rahulmutt at gmail.com
Wed Nov 2 05:58:02 UTC 2016
Use the isTrue# function which is made visible by importing GHC.Base.
isTrue# (x <=# y) :: Bool
You can show an Int# by wrapping it up in an I# data constructor and
applying show to it:
x# :: Int#
show (I# x#) ::String
You can make the I# data constructor visible via GHC.Base like above.
Hope that helps!
On Wed, Nov 2, 2016 at 11:20 AM, Richard A. O'Keefe <ok at cs.otago.ac.nz>
> I have x, y :: Int#
> I expect that x <=# y :: Bool
> but ghc 7.8 says
> Couldn't match expected type â€˜Boolâ€™ with actual type â€˜Int#â€™
> In the expression: x <=# y
> In an equation for â€˜bâ€™: b = x <=# y
> I have MagicHash and I've imported the right modules so that
> <=# is recognised as *something*, but at this point I'm baffled.
> I'm also not clear on how I can show an Int#.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe