
It compiles, but it doesn't work when i try to use it on lists. There
are some bugs in that code, but I need some time to fix it.
2008/3/21 Bas van Dijk
2008/3/21 Krzysztof Skrzętnicki
: ...
I'd like to write the following code:
instance (Ord a) => YOrd a where ycmp x y = case x `compare` y of LT -> (x,y) GT -> (y,x) EQ -> (x,y)
But i get an error "Undecidable instances" for any type [a]. Does anyone know the way to solve this?
The module compiles fine when you add the following pragma's to your module:
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-}
See: http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-extension... http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-extension...
regards,
Bas