On 8/24/10 1:54 PM, Bartek Æwik³owski wrote:
Hello Michael,

This is because instance selection is solely based on instance heads,
it doesn't consider contexts. There's a nice explanation available
here: http://www.haskell.org/haskellwiki/GHC/AdvancedOverlap

The fix in this case is very easy because there are only two cases
(and you don't want to provide new Nat class instances):

instance Show Z where
     show _ = "0"

instance Nat n =>  Show (S n) where
     show _ = show $ toInt (undefined :: n) + 1

regards,
Bartek Æwik³owski
OK, thanks!

Mike
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to