Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
refactor: rename base module
Browse files Browse the repository at this point in the history
Rename base module from 'Strings' to 'MCSP'.
  • Loading branch information
marmitar committed Aug 31, 2023
1 parent 8cebf66 commit 5597d4d
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 50 deletions.
8 changes: 4 additions & 4 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import Data.Store (Size (ConstSize), Store (size), decodeIO, encode)
import Data.Word (Word8)
import GHC.Generics (Generic)

import Strings.Data.Partition (randomShuffledBlocks)
import Strings.Data.String (String)
import Strings.Data.String.Deriving (derivingUnboxVia)
import Strings.System.Random (generate)
import MCSP.Data.Partition (randomShuffledBlocks)
import MCSP.Data.String (String)
import MCSP.Data.String.Deriving (derivingUnboxVia)
import MCSP.System.Random (generate)

data Letter = A | C | G | T
deriving stock (Show, Read, Eq, Ord, Enum, Bounded, Generic)
Expand Down
6 changes: 3 additions & 3 deletions bench/Bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import Control.Monad (replicateM)
import Criterion.Main (Benchmark, bench, bgroup, defaultMain, nf)
import Data.String qualified as Text

import Strings.Data.String (String)
import Strings.Heuristics.Combine (combineHeuristic, combineHeuristicS)
import Strings.System.Random (generate)
import MCSP.Data.String (String)
import MCSP.Heuristics.Combine (combineHeuristic, combineHeuristicS)
import MCSP.System.Random (generate)

import TestLib.Heuristics (MCSPHeuristic, StringParameters (..), genStringPair, testHeuristic)

Expand Down
14 changes: 7 additions & 7 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ ghc-options:
library:
source-dirs: src
exposed-modules:
- Strings.Data.Partition
- Strings.Data.RadixTree
- Strings.Data.String
- Strings.Data.String.Deriving
- Strings.Data.String.Extra
- Strings.Heuristics.Combine
- Strings.System.Random
- MCSP.Data.Partition
- MCSP.Data.RadixTree
- MCSP.Data.String
- MCSP.Data.String.Deriving
- MCSP.Data.String.Extra
- MCSP.Heuristics.Combine
- MCSP.System.Random

internal-libraries:
MCSP-Algorithms-test-lib:
Expand Down
6 changes: 3 additions & 3 deletions src/Strings/Data/Partition.hs → src/MCSP/Data/Partition.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | Operations on partitions of `String`.
module Strings.Data.Partition (
module MCSP.Data.Partition (
Partition,
PartitionPair,
SimpleEnum,
Expand All @@ -18,8 +18,8 @@ import Data.Int (Int)
import GHC.Enum (Bounded, Enum)
import GHC.Num ((-))

import Strings.Data.String (String (Null, (:>), (:>:)), Unbox, concat, replicateM)
import Strings.System.Random (Random, partitions, shuffle, uniformE, uniformRE)
import MCSP.Data.String (String (Null, (:>), (:>:)), Unbox, concat, replicateM)
import MCSP.System.Random (Random, partitions, shuffle, uniformE, uniformRE)

-- | A collection of substrings of the same string.
type Partition a = [String a]
Expand Down
6 changes: 3 additions & 3 deletions src/Strings/Data/RadixTree.hs → src/MCSP/Data/RadixTree.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | A compressed trie of string radices.
module Strings.Data.RadixTree (
module MCSP.Data.RadixTree (
-- * Data Types
RadixTree,
Map.RadixTreeMap,
Expand All @@ -26,8 +26,8 @@ import Data.List (map)
import Data.Maybe (Maybe)
import Data.Ord (Ord)

import Strings.Data.RadixTree.Map qualified as Map
import Strings.Data.String (String (..))
import MCSP.Data.RadixTree.Map qualified as Map
import MCSP.Data.String (String (..))

-- | A set of `String`s represented by a [radix tree](https://en.wikipedia.org/wiki/Radix_tree).
--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | A map of `String` keys represented by a radix tree.
module Strings.Data.RadixTree.Map (
module MCSP.Data.RadixTree.Map (
-- * Data Types
RadixTreeMap (..),
Edge (..),
Expand Down Expand Up @@ -51,8 +51,8 @@ import Text.Show (Show (showsPrec), showChar, showParen, showString, shows)
import Data.Map.Strict qualified as Map
import Data.Map.Strict.Internal (Map (Bin))

import Strings.Data.String (ShowString, String (..), Unbox, (++))
import Strings.Data.String.Prefix (splitCommonPrefix, stripPrefix)
import MCSP.Data.String (ShowString, String (..), Unbox, (++))
import MCSP.Data.String.Prefix (splitCommonPrefix, stripPrefix)

-- --------------- --
-- Data definition --
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | A compressed trie of string suffixes.
module Strings.Data.RadixTree.Suffix (
module MCSP.Data.RadixTree.Suffix (
SuffixTree,
suffixes,
construct,
Expand All @@ -16,8 +16,8 @@ import Data.Ord (Ord (..))
import Data.Semigroup (Semigroup (..))
import Text.Show (Show)

import Strings.Data.RadixTree.Map qualified as Map
import Strings.Data.String (String (..), length)
import MCSP.Data.RadixTree.Map qualified as Map
import MCSP.Data.String (String (..), length)

-- --------------- --
-- Data definition --
Expand Down
4 changes: 2 additions & 2 deletions src/Strings/Data/String.hs → src/MCSP/Data/String.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | Generic strings using backed by a contiguous array of unboxed characters.
module Strings.Data.String (
module MCSP.Data.String (
-- * Unboxed string
String (.., Unboxed, Null, NonNull, Head, Last, Singleton, (:<), (:>), (:<:), (:>:)),
Unbox,
Expand Down Expand Up @@ -182,7 +182,7 @@ import Data.Vector.Generic qualified as Generic
import Data.Vector.Generic.Mutable qualified as Mutable
import Data.Vector.Unboxed (MVector, Unbox, Vector)

import Strings.Data.String.Text (ReadString (..), ShowString (..), readCharsPrec)
import MCSP.Data.String.Text (ReadString (..), ShowString (..), readCharsPrec)

-- --------------- --
-- Data definition --
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | Simplified `derivingUnbox`.
module Strings.Data.String.Deriving (
module MCSP.Data.String.Deriving (
EnumLike,
derivingUnboxVia,
) where
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-- | Custom operations for `String`.
module Strings.Data.String.Extra (
module MCSP.Data.String.Extra (
-- ** Character set analysis
frequency,
singletons,
hasOneOf,

-- ** Substring analysis
module Strings.Data.String.Prefix,
module MCSP.Data.String.Prefix,
suffixes,
longestCommonSubstring,
) where
Expand All @@ -22,9 +22,9 @@ import Data.Ord (Ord)
import Data.Set (Set, insert, member)
import GHC.Num ((+))

import Strings.Data.RadixTree.Suffix (construct, findMax, suffixes)
import Strings.Data.String (String)
import Strings.Data.String.Prefix
import MCSP.Data.RadixTree.Suffix (construct, findMax, suffixes)
import MCSP.Data.String (String)
import MCSP.Data.String.Prefix

-- ---------------------- --
-- Character set analysis --
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | Prefix operations on `String`.
module Strings.Data.String.Prefix (
module MCSP.Data.String.Prefix (
stripPrefix,
isPrefixOf,
commonPrefix,
Expand All @@ -15,7 +15,7 @@ import Data.Ord (min)
import Data.Tuple.Extra (fst3)
import GHC.Num ((-))

import Strings.Data.String (String, length, splitAt, take, unsafeIndex, unsafeSlice)
import MCSP.Data.String (String, length, splitAt, take, unsafeIndex, unsafeSlice)

-- ---------------------- --
-- String prefix analysis --
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE UndecidableInstances #-}

-- | Textual conversion for strings.
module Strings.Data.String.Text (
module MCSP.Data.String.Text (
ShowString (..),
ReadString (..),
readCharsPrec,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | Combine Heuristics for solving the MCSP problem.
module Strings.Heuristics.Combine (
module MCSP.Heuristics.Combine (
combineHeuristic,
combineHeuristicS,
) where
Expand All @@ -9,9 +9,9 @@ import Prelude hiding (String, (++))
import Data.Bifunctor (first, second)
import Data.Set (Set)

import Strings.Data.Partition (PartitionPair, chars)
import Strings.Data.String (String, (++))
import Strings.Data.String.Extra (hasOneOf, singletons)
import MCSP.Data.Partition (PartitionPair, chars)
import MCSP.Data.String (String, (++))
import MCSP.Data.String.Extra (hasOneOf, singletons)

-- | Applies a function until the result converges.
converge :: Eq a => (a -> a) -> a -> a
Expand Down
4 changes: 2 additions & 2 deletions src/Strings/System/Random.hs → src/MCSP/System/Random.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | Randomized operations using a `Random` monad for "PCG" operations.
module Strings.System.Random (
module MCSP.System.Random (
Random,
Seed,
staticSeed,
Expand Down Expand Up @@ -30,7 +30,7 @@ import System.Random.PCG qualified as PCG
import System.Random.PCG.Class (Generator)
import System.Random.Shuffle qualified as Shuffle (shuffle)

import Strings.System.Random.Static (mkWord64)
import MCSP.System.Random.Static (mkWord64)

-- | A monad capable of producing random values of @a@.
type Random a = forall g m. Generator g m => RandT g m a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | Compile time random value generation.
module Strings.System.Random.Static (
module MCSP.System.Random.Static (
mkWord64,
RandomIO,
mkRandomQ,
Expand Down
6 changes: 3 additions & 3 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import Data.String qualified as Text
import System.IO (IO, putStrLn)
import Text.Show (Show, show)

import Strings.Data.RadixTree (construct)
import Strings.Data.String (String, concat)
import Strings.System.Random (generate, shuffle)
import MCSP.Data.RadixTree (construct)
import MCSP.Data.String (String, concat)
import MCSP.System.Random (generate, shuffle)

assertEq :: (Show a, Eq a) => Text.String -> a -> a -> IO Bool
assertEq function expected found
Expand Down
6 changes: 3 additions & 3 deletions test/lib/TestLib/Heuristics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module TestLib.Heuristics (

import Prelude hiding (String)

import Strings.Data.Partition (PartitionPair, randomShuffledCharsWithSingletons)
import Strings.Data.String (String)
import Strings.System.Random (Random)
import MCSP.Data.Partition (PartitionPair, randomShuffledCharsWithSingletons)
import MCSP.Data.String (String)
import MCSP.System.Random (Random)

-- | Heuristic for the MCSP problem.
type MCSPHeuristic a = String a -> String a -> PartitionPair a
Expand Down

0 comments on commit 5597d4d

Please sign in to comment.