did some cleanup

This commit is contained in:
Dennis Frieberg 2020-08-26 16:14:09 +02:00
parent 83a644e2ab
commit 9ca133ca56
2 changed files with 0 additions and 31 deletions

View file

@ -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

View file

@ -1,6 +0,0 @@
module Lib
( someFunc
) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"