- Create a new project priority-queue with the default Stack template:
stack new priority-queue
- Delete the src/Lib.hs file. Create a directory src/Data/ and create a new file src/Data/PriorityQueue.hs. We will add implementation of priority queue here.
- Open priority-queue.cabal. Remove Lib from the exposed-modules subsection from the library section. Replace it with our new Data.PriorityQueue module:
library hs-source-dirs: src exposed-modules: Data.PriorityQueue build-depends: base >= 4.7 && < 5 default-language: Haskell2010
- Open src/Data/PriorityQueue.hs. We will implement the priority queue here.
- Add the module definition for Data.PriorityQueue:
module Data.PriorityQueue where
- Let's define the Queue as a sum type. ...