did some cleanup
This commit is contained in:
parent
83a644e2ab
commit
9ca133ca56
2 changed files with 0 additions and 31 deletions
|
@ -1,25 +0,0 @@
|
||||||
-- |
|
|
||||||
-- Module: Queue
|
|
||||||
-- Description: A simple functional Queue
|
|
||||||
-- Stability: experimental
|
|
||||||
module Data.Queue where
|
|
||||||
|
|
||||||
data Queue a = Queue [a] [a]
|
|
||||||
deriving (Show)
|
|
||||||
|
|
||||||
instance Foldable Queue where
|
|
||||||
foldr f a (Queue xs ys) = foldr f a (xs ++ (reverse ys))
|
|
||||||
|
|
||||||
enqueue :: Queue a -> a -> Queue a
|
|
||||||
enqueue (Queue xs ys) a = Queue (a:xs) ys
|
|
||||||
|
|
||||||
dequeue :: Queue a -> (Queue a,Maybe a)
|
|
||||||
dequeue q@(Queue [] []) = (q,Nothing)
|
|
||||||
dequeue q@(Queue xs (y:ys)) = (Queue xs ys, Just y)
|
|
||||||
dequeue q@(Queue xs@(t:ts) []) = let ys = reverse xs in (Queue [] (tail ys), Just (head ys))
|
|
||||||
|
|
||||||
isEmpty :: Queue a -> Bool
|
|
||||||
isEmpty (Queue [] []) = True
|
|
||||||
isEmpty _ = False
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
module Lib
|
|
||||||
( someFunc
|
|
||||||
) where
|
|
||||||
|
|
||||||
someFunc :: IO ()
|
|
||||||
someFunc = putStrLn "someFunc"
|
|
Loading…
Reference in a new issue