linear-base icon indicating copy to clipboard operation
linear-base copied to clipboard

Change structure of `examples`, `test`, `bench`, and `test-examples` to follow the one from `src`

Open tbagrel1 opened this issue 1 year ago • 1 comments

I noticed that there are some inconsistencies in the naming of test/bench executables of linear-base. In particular:

  • Most paths on mutable structures were in src/Data.<structure>.Mutable while the associated test/bench module was <exe>/Data.Mutable.<structure>
  • bench was missing a top Bench module name component, so names could conflict with the ones in src
  • some test modules for array were missing the Array module name component

Here's the exhaustive changelog:

    renamed:    bench/Data/Mutable/Array.hs       -> bench/Bench/Data/Array/Mutable.hs
    renamed:    bench/Data/Mutable/Quicksort.hs   -> bench/Bench/Data/Array/Mutable/Quicksort.hs
    renamed:    bench/Data/Mutable/HashMap.hs     -> bench/Bench/Data/HashMap/Mutable.hs
    modified:   bench/Main.hs (to adjust module names accordingly)

    renamed:    examples/Simple/Quicksort.hs      -> examples/Data/Array/Mutable/Quicksort.hs
    renamed:    examples/Simple/TopSort.hs        -> examples/Data/HashMap/Mutable/TopSort.hs
    modified:   examples/README.md (to adjust module names and add new ones)
    
    renamed:    test/Test/Data/Destination.hs     -> test/Test/Data/Array/Destination.hs
    renamed:    test/Test/Data/Mutable/Array.hs   -> test/Test/Data/Array/Mutable.hs
    renamed:    test/Test/Data/Polarized.hs       -> test/Test/Data/Array/Polarized.hs
    renamed:    test/Test/Data/Mutable/HashMap.hs -> test/Test/Data/HashMap/Mutable.hs
    renamed:    test/Test/Data/Mutable/Set.hs     -> test/Test/Data/Set/Mutable.hs
    renamed:    test/Test/Data/Mutable/Vector.hs  -> test/Test/Data/Vector/Mutable.hs
    modified:   test/Main.hs (to adjust module names accordingly)
    
    renamed:    test-examples/Test/Simple/Quicksort.hs -> test-examples/Test/Data/Array/Mutable/Quicksort.hs
    modified:   test-examples/Main.hs (to adjust module names accordingly)
    
    modified:   linear-base.cabal (to adjust module names accordingly)

tbagrel1 avatar Sep 25 '24 08:09 tbagrel1

I object to the renaming of the example/ subdirectory. These examples aren't meant to be sorted accorded to the what modules they exercise (indeed they exercise several). They are meant to be consumed by someone who's browsing the library and want to see it being deployed. So we need to optimise for this perusal.

Maybe you want to prefix them with Example anyway, just to make sure they don't clash with anything else. For future-proofing, I mean. But let's make sure that the examples are optimised for the reader, not for the library authors that we are.

The rest looks quite reasonable.

aspiwack avatar Sep 26 '24 07:09 aspiwack