From ea3f1f7736c57747e743a5106b917d2853c62f57 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 13 Sep 2012 02:14:04 +1000 Subject: Cleaner directory structure, addition of make clean, grouping of library modules into a single package --- Stack.hs | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 Stack.hs (limited to 'Stack.hs') diff --git a/Stack.hs b/Stack.hs deleted file mode 100644 index 2b369b7..0000000 --- a/Stack.hs +++ /dev/null @@ -1,39 +0,0 @@ -module Stack ( - Stack, - empty, - at, - pop, - (<:>) - ) where - - -import Data.List - - -data Stack a = Stack [a] - - -instance Show a => Show (Stack a) where - show (Stack x) = "Stack:\n" ++ intercalate "\n" (map (show) x) ++ "\n\n" - - -infixr 9 <:> - - -empty :: Stack a -empty = Stack [] - - -at :: Stack a -> Int -> Maybe a -at (Stack list) index = - if (index < length list && index >= 0) - then Just (list!!index) - else Nothing - - -pop :: Int -> Stack a -> Stack a -pop n (Stack list) = Stack (drop n list) - - -(<:>) :: a -> Stack a -> Stack a -x <:> (Stack list) = Stack (x : list) -- cgit