
21 Mar
2008
21 Mar
'08
4:43 a.m.
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