Skip to content

Commit

Permalink
Move new KeyMap/HashMap into its own package compact-map
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Oct 26, 2021
1 parent f4090cf commit a351b87
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Expand Up @@ -22,6 +22,7 @@ packages:
libs/non-integral
libs/small-steps
libs/small-steps-test
libs/compact-map

-- Deprecations
eras/shelley/chain-and-ledger/executable-spec
Expand Down Expand Up @@ -183,4 +184,3 @@ package small-steps-test

package small-steps
ghc-options: -Werror

3 changes: 3 additions & 0 deletions libs/compact-map/CHANGELOG.md
@@ -0,0 +1,3 @@
# Revision history for compact-map


3 changes: 3 additions & 0 deletions libs/compact-map/Setup.hs
@@ -0,0 +1,3 @@
import Distribution.Simple

main = defaultMain
62 changes: 62 additions & 0 deletions libs/compact-map/compact-map.cabal
@@ -0,0 +1,62 @@
cabal-version: 2.2

name: compact-map
version: 0.1.0.0
synopsis: A KeyMap that is based on collisionless HashMap implementation
homepage: https://github.com/input-output-hk/cardano-legder-specs
license: Apache-2.0
author: IOHK Formal Methods Team
maintainer: formal.methods@iohk.io
category: Control
build-type: Simple
extra-source-files: CHANGELOG.md

source-repository head
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
subdir: libs/compact-map

common project-config
default-language: Haskell2010

ghc-options: -Wall
-Wcompat
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wredundant-constraints
-Wunused-packages

library
import: project-config

exposed-modules: Data.Compact.KeyMap
, Data.Compact.HashMap
other-modules: Data.Compact.Class
build-depends: base >=4.11 && <5
, array
, containers
, deepseq
, prettyprinter
, primitive
, random
, text
, cardano-prelude
hs-source-dirs: src

test-suite tests
import: project-config

hs-source-dirs: test
main-is: Main.hs
other-modules: Test.Compact.KeyMap
type: exitcode-stdio-1.0
default-language: Haskell2010
build-depends: base
, containers
, tasty
, tasty-expected-failure
, tasty-quickcheck
, tasty-hunit
, compact-map
, QuickCheck
ghc-options: -threaded
File renamed without changes.
Expand Up @@ -51,4 +51,4 @@ toList :: HashMap k v -> [(k, v)]
toList (HashMap m) = KM.foldWithAscKey (\ ans k v -> (fromKey k,v):ans) [] m

mapWithKey :: (k -> v -> u) -> HashMap k v -> HashMap k u
mapWithKey f (HashMap m) = HashMap (KM.mapWithKey (\ key v -> f (fromKey key) v) m)
mapWithKey f (HashMap m) = HashMap (KM.mapWithKey (\ key v -> f (fromKey key) v) m)
File renamed without changes.
16 changes: 16 additions & 0 deletions libs/compact-map/test/Main.hs
@@ -0,0 +1,16 @@
module Main where

import Test.Compact.KeyMap
import Test.Tasty

-- ====================================================================================

tests :: TestTree
tests =
testGroup
"compcat-map"
[ keyMapTests
]

main :: IO ()
main = defaultMain tests
7 changes: 7 additions & 0 deletions libs/compact-map/test/Test/Compact/KeyMap.hs
@@ -0,0 +1,7 @@
module Test.Compact.KeyMap where

import Data.Compact.KeyMap
import Test.Tasty

keyMapTests :: TestTree
keyMapTests = testGroup "KeyMap" []
3 changes: 0 additions & 3 deletions libs/small-steps/small-steps.cabal
Expand Up @@ -45,9 +45,6 @@ library
, Data.CanonicalMaps
, Data.MemoBytes
, Data.Coders
, Data.Compact.Class
, Data.Compact.KeyMap
, Data.Compact.HashMap
, Data.Pulse
, Control.Provenance
, Control.Iterate.SetAlgebra
Expand Down

0 comments on commit a351b87

Please sign in to comment.