[Haskell-beginners] Writing a custom pop function for a stack data type

doaltan doaltan at yahoo.co.uk
Tue Mar 12 11:42:13 CET 2013

Hi I have such a stack data structure: 
datamystack =Empty |Elem Char mystack derivingShow

I'm trying to get the head of the stack using this:
pophead :: Stack -> Char
pophead Empty = Empty 
pophead (Element x stack) = x
And I'm getting this error for the last sentence of the function :
Not in scope: data constructor `Stack'
Can you tell me how to fix it? 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130312/f641b3e4/attachment.htm>

More information about the Beginners mailing list