
12 Mar
2013
12 Mar
'13
8:46 a.m.
Hi, Dnia 2013-03-12, wto o godzinie 11:06 +0000, doaltan pisze:
Actually I'm getting the error with this :
data Stack = Empty | Elem Char Stack deriving Show
pophead :: Stack -> Char pophead Empty = Empty pophead (Elem x stack) = x
pophead should return Char. You can't return Stack if you defined the type of pophead as Stack -> Char. You can try to use Maybe here and return Maybe Char (Just x or Nothing) or you can use error function to raise an error. You can use _ instead of stack like this: pophead (Elem x _) = x Emanuel