
13 Dec
2009
13 Dec
'09
10:56 a.m.
data Stack a = Top (Stack a) | Layers [a] deriving (Show)
Sorry I'm asking - but why Stack is either a 'Stack or List' - shouldn't it be either plain list or list-lile structure: data Stack a = EmptyStack | Stack a (Stack a) (unless you're training 'data' I'd say newtype Stack a = Stack [a]) Otherwise Top (Top (Layers [])) is a stack (yet it does not fit into rest of the functions) or even fix Top (i.e. Top (Top (Top (Top (...) Unless it have some reason of course. Regards