Note: this is the stubbed version of module Queue. You should
download the lhs version of this
module and replace all parts marked
undefined
.
Eventually, the complete
version will be made available.
Exercise: Purely Functional Queues
> {-# LANGUAGE ScopedTypeVariables, TypeApplications, AllowAmbiguousTypes #-}
>
> {-# OPTIONS_GHC -fdefer-type-errors #-}
> module Queue where
> import Test.QuickCheck
- Define an interface for a purely functional Queue (FIFO) using a type class. It must (at least) have a way to add an element to the end of the queue (enqueue) and remove the element at the beginning of the queue (dequeue).
- Define some properties that your queue should satisfy.
- Implement your interface.
- Make an arbitrary instance.
- Run your tests.