Skip to content

Commit d54e402

Browse files
committed
Change structure of examples, tests, bench, and tests-examples to properly match src structure
1 parent 9a7dc1b commit d54e402

File tree

17 files changed

+42
-40
lines changed

17 files changed

+42
-40
lines changed

bench/Data/Mutable/Array.hs renamed to bench/Bench/Data/Array/Mutable.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
-- land in a file named “Array.dump-simpl”
1212
-- {-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all -dsuppress-uniques #-}
1313

14-
module Data.Mutable.Array (benchmarks) where
14+
module Bench.Data.Array.Mutable (benchmarks) where
1515

1616
import Control.DeepSeq (rnf)
1717
import qualified Data.Array.Mutable.Linear as Array.Linear

bench/Data/Mutable/Quicksort.hs renamed to bench/Bench/Data/Array/Mutable/Quicksort.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{-# LANGUAGE NumericUnderscores #-}
22

3-
module Data.Mutable.Quicksort (benchmarks) where
3+
module Bench.Data.Array.Mutable.Quicksort (benchmarks) where
44

55
import Control.DeepSeq (force)
66
import Control.Exception (evaluate)
7+
import Data.Array.Mutable.Quicksort (quicksortUsingArray, quicksortUsingList)
78
import Data.List (sort)
8-
import Simple.Quicksort (quicksortUsingArray, quicksortUsingList)
99
import System.Random
1010
import Test.Tasty.Bench
1111

bench/Data/Mutable/HashMap.hs renamed to bench/Bench/Data/HashMap/Mutable.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{-# LANGUAGE StandaloneDeriving #-}
1212
{-# LANGUAGE TupleSections #-}
1313

14-
module Data.Mutable.HashMap (benchmarks) where
14+
module Bench.Data.HashMap.Mutable (benchmarks) where
1515

1616
import Control.DeepSeq (NFData (..), deepseq, force)
1717
import qualified Control.Monad.Random as Random

bench/Main.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module Main where
22

3-
import qualified Data.Mutable.Array as Array
4-
import qualified Data.Mutable.HashMap as HashMap
5-
import qualified Data.Mutable.Quicksort as Quicksort
3+
import qualified Bench.Data.Array.Mutable as Array
4+
import qualified Bench.Data.Array.Mutable.Quicksort as Quicksort
5+
import qualified Bench.Data.HashMap.Mutable as HashMap
66
import Test.Tasty.Bench (defaultMain)
77

88
main :: IO ()
99
main = do
1010
defaultMain
1111
[ Array.benchmarks,
12-
HashMap.benchmarks,
13-
Quicksort.benchmarks
12+
Quicksort.benchmarks,
13+
HashMap.benchmarks
1414
]

examples/Simple/Quicksort.hs renamed to examples/Data/Array/Mutable/Quicksort.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
-- {-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all -dsuppress-uniques #-}
77

88
-- | This module implements quicksort with mutable arrays from linear-base
9-
module Simple.Quicksort where
9+
module Data.Array.Mutable.Quicksort where
1010

1111
import Data.Array.Mutable.Linear (Array)
1212
import qualified Data.Array.Mutable.Linear as Array

examples/Simple/TopSort.hs renamed to examples/Data/HashMap/Mutable/TopSort.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{-# OPTIONS_GHC -Wno-name-shadowing #-}
66
{-# OPTIONS_GHC -Wno-unused-matches #-}
77

8-
module Simple.TopSort where
8+
module Data.HashMap.Mutable.TopSort where
99

1010
import Data.Bifunctor.Linear (second)
1111
import qualified Data.Functor.Linear as Data

examples/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Examples
22

3+
* `Data`
4+
* These are examples of using the pure linear interface of mutable
5+
data structures provided by linear base.
36
* `Simple`
47
* These are tutorial level examples for understanding linear
58
types and using bread-and-butter tools in linear base.
69
* Recommended order: `Pure`, `FileIO`.
710
* `Foreign`
811
* These are examples of explicitly allocating off the GC heap's
9-
memory and on the system heap's memory
10-
12+
memory and on the system heap's memory.

linear-base.cabal

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ library examples
153153
Foreign.Heap
154154
Simple.FileIO
155155
Simple.Pure
156-
Simple.Quicksort
157-
Simple.TopSort
156+
Data.Array.Mutable.Quicksort
157+
Data.HashMap.Mutable.TopSort
158158
build-depends:
159159
base,
160160
linear-base,
@@ -169,12 +169,12 @@ test-suite test
169169
main-is: Main.hs
170170
hs-source-dirs: test
171171
other-modules:
172-
Test.Data.Destination
173-
Test.Data.Mutable.Array
174-
Test.Data.Mutable.Vector
175-
Test.Data.Mutable.HashMap
176-
Test.Data.Mutable.Set
177-
Test.Data.Polarized
172+
Test.Data.Array.Destination
173+
Test.Data.Array.Mutable
174+
Test.Data.Vector.Mutable
175+
Test.Data.HashMap.Mutable
176+
Test.Data.Set.Mutable
177+
Test.Data.Array.Polarized
178178
Test.Data.Functor.Linear
179179
Test.Data.V
180180
Test.Data.Replicator
@@ -200,7 +200,7 @@ test-suite test-examples
200200
hs-source-dirs: test-examples
201201
other-modules:
202202
Test.Foreign
203-
Test.Simple.Quicksort
203+
Test.Data.Array.Mutable.Quicksort
204204
default-language: Haskell2010
205205
build-depends:
206206
base,
@@ -217,9 +217,9 @@ benchmark bench
217217
main-is: Main.hs
218218
hs-source-dirs: bench
219219
other-modules:
220-
Data.Mutable.HashMap
221-
Data.Mutable.Array
222-
Data.Mutable.Quicksort
220+
Bench.Data.HashMap.Mutable
221+
Bench.Data.Array.Mutable
222+
Bench.Data.Array.Mutable.Quicksort
223223
default-language: Haskell2010
224224
build-depends:
225225
base,

test-examples/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Main where
22

3+
import Test.Data.Array.Mutable.Quicksort (quicksortTests)
34
import Test.Foreign (foreignGCTests)
4-
import Test.Simple.Quicksort (quicksortTests)
55
import Test.Tasty
66

77
main :: IO ()

test-examples/Test/Simple/Quicksort.hs renamed to test-examples/Test/Data/Array/Mutable/Quicksort.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{-# LANGUAGE OverloadedStrings #-}
22

3-
module Test.Simple.Quicksort (quicksortTests) where
3+
module Test.Data.Array.Mutable.Quicksort (quicksortTests) where
44

5+
import Data.Array.Mutable.Quicksort (quicksortUsingArray, quicksortUsingList)
56
import Data.List (sort)
67
import Hedgehog
78
import qualified Hedgehog.Gen as Gen
89
import qualified Hedgehog.Range as Range
9-
import Simple.Quicksort (quicksortUsingArray, quicksortUsingList)
1010
import Test.Tasty
1111
import Test.Tasty.Hedgehog (testPropertyNamed)
1212

0 commit comments

Comments
 (0)