aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/CHANGELOG.md5
-rw-r--r--common/LICENSE30
-rw-r--r--common/common.cabal23
-rw-r--r--common/src/Collection.hs30
-rw-r--r--common/src/Version.hs47
5 files changed, 0 insertions, 135 deletions
diff --git a/common/CHANGELOG.md b/common/CHANGELOG.md
deleted file mode 100644
index 47b7089..0000000
--- a/common/CHANGELOG.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Revision history for common
-
-## 0.1.0.0 -- YYYY-mm-dd
-
-* First version. Released on an unsuspecting world.
diff --git a/common/LICENSE b/common/LICENSE
deleted file mode 100644
index c90516a..0000000
--- a/common/LICENSE
+++ /dev/null
@@ -1,30 +0,0 @@
-Copyright (c) 2024, Alexander Foremny
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * Neither the name of Alexander Foremny nor the names of other
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/common/common.cabal b/common/common.cabal
deleted file mode 100644
index d67e5d6..0000000
--- a/common/common.cabal
+++ /dev/null
@@ -1,23 +0,0 @@
-cabal-version: 3.4
-name: common
-version: 0.2.0
-license: BSD-3-Clause
-license-file: LICENSE
-maintainer: aforemny@posteo.de
-author: Alexander Foremny
-build-type: Simple
-extra-doc-files: CHANGELOG.md
-
-library
- exposed-modules: Version,
- Collection
- hs-source-dirs: src
- default-language: GHC2021
- default-extensions: ViewPatterns
- ghc-options: -Wall
- build-depends:
- aeson,
- base,
- miso,
- split,
- text
diff --git a/common/src/Collection.hs b/common/src/Collection.hs
deleted file mode 100644
index 418278d..0000000
--- a/common/src/Collection.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ViewPatterns #-}
-
-module Collection where
-
-import Miso.String (MisoString, toMisoString)
-import Text.ParserCombinators.ReadP qualified as R
-import Text.ParserCombinators.ReadPrec qualified as R
-import Text.Read (Read (..))
-
-newtype Collection = Collection {name :: MisoString}
- deriving (Read, Eq, Show)
-
-data CollectionItem = CollectionItem
- { collection :: Collection,
- itemFileName :: FilePath
- }
- deriving (Eq)
-
-instance Read CollectionItem where
- readPrec = R.lift $ do
- (Collection . toMisoString -> collection) <- R.munch (/= '/')
- _ <- R.string "/"
- itemFileName <- R.munch (const True)
- pure CollectionItem {..}
-
-instance Show CollectionItem where
- show (CollectionItem {collection = Collection cn, itemFileName}) =
- show (cn <> "/" <> toMisoString itemFileName)
diff --git a/common/src/Version.hs b/common/src/Version.hs
deleted file mode 100644
index 6970968..0000000
--- a/common/src/Version.hs
+++ /dev/null
@@ -1,47 +0,0 @@
-module Version
- ( Version (..),
- versionToString,
- versionFromText,
- versionFromString,
- )
-where
-
-import Data.Aeson qualified as A
-import Data.Aeson.Types qualified as A
-import Data.Function (on)
-import Data.List
-import Data.List.Split
-import Data.Maybe (fromMaybe)
-import Data.String (IsString (..))
-import Data.Text qualified as T
-
-data Version = Version Int Int Int
- deriving (Show, Eq)
-
-instance Ord Version where
- compare = compare `on` toTriple
-
-toTriple :: Version -> (Int, Int, Int)
-toTriple (Version major minor patch) = (major, minor, patch)
-
-instance A.ToJSON Version where
- toJSON = A.toJSON . versionToString
-
-instance A.FromJSON Version where
- parseJSON (A.String (versionFromText -> Just version)) = pure version
- parseJSON v = A.typeMismatch "version" v
-
-versionToString :: Version -> String
-versionToString (Version major minor patch) =
- intercalate "." (map show [major, minor, patch])
-
-versionFromString :: String -> Maybe Version
-versionFromString (map read . splitOn "." -> [major, minor, patch]) =
- Just (Version major minor patch)
-versionFromString _ = Nothing
-
-versionFromText :: T.Text -> Maybe Version
-versionFromText = versionFromString . T.unpack
-
-instance IsString Version where
- fromString = fromMaybe (error "") . versionFromString