sebfisch / uniqueid

Splittable Unique Identifier Supply for Haskell
http://github.com/sebfisch/uniqueid/wikis
Other
6 stars 2 forks source link

Couldn't match expected type ‘Bool’ with actual type ‘Int#’ #2

Open ivanperez-keera opened 4 years ago

ivanperez-keera commented 4 years ago

I'm getting:

Building library for uniqueid-0.1.1..
[1 of 1] Compiling Data.Unique.Id   ( Data/Unique/Id.hs, dist/dist-sandbox-34bfcd1f/build/Data/Unique/Id.o )

Data/Unique/Id.hs:58:47: error:
    • Couldn't match expected type ‘Bool’ with actual type ‘Int#’
    • In the expression: x ==# y
      In an equation for ‘==’: Id (I# x) == Id (I# y) = x ==# y
      In the instance declaration for ‘Eq Id’
   |
58 | instance Eq Id where Id (I# x) == Id (I# y) = x ==# y
   |                                               ^^^^^^^

Data/Unique/Id.hs:62:28: error:
    • Couldn't match expected type ‘Bool’ with actual type ‘Int#’
    • In the expression: x <# y
      In an equation for ‘<’: Id (I# x) < Id (I# y) = x <# y
      In the instance declaration for ‘Ord Id’
   |
62 |   Id (I# x) <  Id (I# y) = x <#  y
   |                            ^^^^^^^

Data/Unique/Id.hs:63:28: error:
    • Couldn't match expected type ‘Bool’ with actual type ‘Int#’
    • In the expression: x <=# y
      In an equation for ‘<=’: Id (I# x) <= Id (I# y) = x <=# y
      In the instance declaration for ‘Ord Id’
   |
63 |   Id (I# x) <= Id (I# y) = x <=# y
   |                            ^^^^^^^

Data/Unique/Id.hs:66:7: error:
    • Couldn't match expected type ‘Bool’ with actual type ‘Int#’
    • In the expression: x ==# y
      In the expression:
        if x ==# y then EQ else if x <# y then LT else GT
      In an equation for ‘compare’:
          compare (Id (I# x)) (Id (I# y))
            = if x ==# y then EQ else if x <# y then LT else GT
   |
66 |    if x ==# y then EQ else if x <# y then LT else GT
   |       ^^^^^^^

Data/Unique/Id.hs:66:31: error:
    • Couldn't match expected type ‘Bool’ with actual type ‘Int#’
    • In the expression: x <# y
      In the expression: if x <# y then LT else GT
      In the expression:
        if x ==# y then EQ else if x <# y then LT else GT
   |
66 |    if x ==# y then EQ else if x <# y then LT else GT
   |                               ^^^^^^
cabal: Leaving directory 'uniqueid-0.1.1/'

once I fix the problem with #1.

ivanperez-keera commented 4 years ago

The issue is that the type of boolean operators for unboxed types changed to work for any enum. To go back to Bool you can use isTrue#.