summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Library/Stack.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Stack.hs b/Library/Stack.hs
index 7292869..29dd17c 100644
--- a/Library/Stack.hs
+++ b/Library/Stack.hs
@@ -3,14 +3,15 @@ module Library.Stack (
empty,
at,
pop,
- (<:>)
+ (<:>),
+ size
) where
import Data.List
-data Stack a = Stack [a]
+data Stack a = Stack [a] deriving (Eq)
instance Show a => Show (Stack a) where
@@ -37,3 +38,7 @@ pop n (Stack list) = Stack (drop n list)
(<:>) :: a -> Stack a -> Stack a
x <:> (Stack list) = Stack (x : list)
+
+
+size :: Stack a -> Int
+size (Stack list) = length list