augustss / MicroHs

Haskell implemented with combinators
Other
367 stars 25 forks source link

Missing instance `(Ord a, Ord b) => Ord (Either a b)` #50

Closed ysangkok closed 4 months ago

ysangkok commented 4 months ago

This instance is available in GHC since base-2.1, so I was hoping to find it in MicroHs too. But it doesn't seem to be there:

> data A = A deriving (Eq, Ord)
> data B = B deriving (Eq, Ord)
> compare (Right A) (Left B)
Exception: "./Interactive.hs": line 8, col 7: Cannot satisfy constraint: (Ord (Either B A))

In GHC 9.10.1 this works:

ghci> data A = A deriving (Eq, Ord)
ghci> data B = B deriving (Eq, Ord)
ghci> compare (Right A) (Left B)
GT
augustss commented 4 months ago

Fixed

ysangkok commented 4 months ago

It doesn't seem to actually work... I still get the same error message. On 291aa53d5681b9b64f428bd7a8a581cac1de41c1 compiled with GHC.

augustss commented 4 months ago

It works for me

...
Type ':quit' to quit, ':help' for help
> data A = A deriving (Eq, Ord)
> data B = B deriving (Eq, Ord)
> compare (Right A) (Left B)
GT
>
ysangkok commented 4 months ago

Ah. My error was that I didn't reinstall the installed standard library in /usr/local/lib. Issue resolved now, many thanks.