
Hi, I'm very, very new to Haskell. I am trying to understand the following error, but I'm having a hard time wrapping my head around the whole type system. Stack module Stack (Stack(..)) where import Prelude hiding (head, tail) class Stack s where empty :: s a isEmpty :: s a -> Bool cons :: s a -> a -> s a head :: s a -> a tail :: s a -> s a data ListStack a = LS [a] deriving (Show) instance Stack ListStack where empty = LS [] isEmpty (LS s) = null s cons (LS s) x = LS(x:s) head(LS(x:_)) = x tail(LS(x:xs)) = LS xs Not using Mixmax yet? The problem is that when I load this code in the interpreter and write>emptyI get the following error <interactive>:108:1: No instance for (Show (s0 a0)) arising from a use of ‘print’ The type variables ‘s0’, ‘a0’ are ambiguous I mean when I write "LS []" it works just fine. But something is wrong with empty. Thanks, Uneeb