packages feed

psqueues-0.1.0.0: psqueues.cabal

name: psqueues
version: 0.1.0.0
license: BSD3
license-file: LICENSE
maintainer: haskell@better.com
bug-reports: https://github.com/bttr/psqueues/issues
synopsis: Pure priority search queues
category: Data Structures
description:
    A priority search queue manages a set of triples of the form
    @(key, priority, value)@ and allows for efficient lookup by key, and
    efficient lookup and removal of the element with minimal priority. This
    package contains three, performant implementations of priority search
    queues, which differ in the requirements on the type of keys.
    .
    * 'IntPSQ's are the most efficient structure, but require the keys to be
      of type 'Int'.
    .
    * 'OrdPSQ's just require the key to implement the `Ord` typeclass, but are
      the slowest structures of the three.
    .
    * 'HashPSQ's require the key to implement both the 'Ord' and 'Hashable'
      typeclasses. They use an 'IntMap' over the hash of the keys combined
      with a 'OrdPSQ' to manage collisions. Except for keys with a very fast
      comparison and small smaps 'HashPSQ's are faster than 'OrdPSQ's.
    .
    Typical use cases for priority search queues are LRU caches, where the
    priority is the time of the last access, and timeout management, where the
    priority is the time at which the timeout should trigger.
build-type: Simple
cabal-version:  >=1.8
extra-source-files:

source-repository head
    type:     git
    location: http://github.com/bttr/psqueues.git

Library
    ghc-options:    -O2 -Wall
    hs-source-dirs: src

    build-depends:
          base     >= 4.2   && < 5
        , deepseq  >= 1.2   && < 1.4
        , hashable >= 1.2.1 && < 1.3

    if impl(ghc>=6.10)
        build-depends: ghc-prim

    exposed-modules:
        Data.HashPSQ
        Data.IntPSQ
        Data.OrdPSQ
    other-modules:
        Data.BitUtil
        Data.HashPSQ.Internal
        Data.IntPSQ.Internal
        Data.OrdPSQ.Internal

benchmark psqueues-benchmarks
    type:           exitcode-stdio-1.0
    hs-source-dirs: src benchmarks
    main-is:        Main.hs
    ghc-options:    -Wall

    build-depends:
          containers           >= 0.5
        , unordered-containers >= 0.2.4
        , criterion            >= 0.8
        , mtl                  >= 2.1
        , fingertree-psqueue   >= 0.3
        , PSQueue              >= 1.1
        , random               >= 1.0

        , base
        , deepseq
        , ghc-prim
        , hashable
        , psqueues

Test-suite psqueues-tests
    cpp-options:    -DTESTING -DSTRICT
    ghc-options:    -Wall
    hs-source-dirs: src tests
    main-is:        Main.hs
    type:           exitcode-stdio-1.0

    other-modules:
        Data.PSQ.Class
        Data.PSQ.Class.Gen
        Data.PSQ.Class.Tests
        Data.PSQ.Class.Util
        Data.HashPSQ.Tests
        Data.IntPSQ.Tests
        Data.OrdPSQ.Tests

    build-depends:
          HUnit                      >= 1.2 && < 1.3
        , QuickCheck                 >= 2.7 && < 2.8
        , test-framework             >= 0.8 && < 0.9
        , test-framework-hunit       >= 0.3 && < 0.4
        , test-framework-quickcheck2 >= 0.3 && < 0.4

        , base
        , array
        , deepseq
        , ghc-prim
        , hashable
        , psqueues
        , tagged