packages feed

ascii-case 1.0.1.0 → 1.0.1.1

raw patch · 5 files changed

+69/−51 lines, 5 filesdep +hspecdep ~basedep ~hashablePVP ok

version bump matches the API change (PVP)

Dependencies added: hspec

Dependency ranges changed: base, hashable

API changes (from Hackage documentation)

Files

ascii-case.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0  name: ascii-case-version: 1.0.1.0+version: 1.0.1.1 synopsis: ASCII letter case category: Data, Text @@ -15,14 +15,14 @@ author: Chris Martin maintainer: Chris Martin, Julie Moronuki -homepage: https://github.com/typeclasses/ascii-bug-Reports: https://github.com/typeclasses/ascii/issues+homepage: https://github.com/typeclasses/ascii-case+bug-reports: https://github.com/typeclasses/ascii-case/issues -build-type: Simple+extra-doc-files: *.md  source-repository head     type: git-    location: git://github.com/typeclasses/ascii.git+    location: git://github.com/typeclasses/ascii-case.git  common base     default-language: Haskell2010@@ -33,7 +33,7 @@      build-depends:         ascii-char ^>= 1.0-      , base >= 4.14 && < 4.18+      , base ^>= 4.14 || ^>= 4.15 || ^>= 4.16 || ^>= 4.17  library     import: base@@ -47,7 +47,7 @@         DeriveGeneric      build-depends:-        hashable >= 1.3 && < 1.5+        hashable ^>= 1.3.5 || ^>= 1.4      exposed-modules:         ASCII.Case@@ -58,9 +58,6 @@     hs-source-dirs: test     main-is: Main.hs -    default-extensions:-        OverloadedStrings-        QuasiQuotes-     build-depends:         ascii-case+      , hspec ^>= 2.8.5 || ^>= 2.9 || ^>= 2.10
+ changelog.md view
@@ -0,0 +1,35 @@+### 1.0.1.1 (2022-12-27)++Rewrite test suite using `hspec`++### 1.0.1.0 (2022-12-22)++Add `opposite :: Case -> Case`++### 1.0.0.11 (2022-10-4)++Drop support for base 4.11 (GHC 8.4) and base 4.12 (GHC 8.6)++### 1.0.0.10 (2022-01-09)++Support GHC 9.2++### 1.0.0.8 (2021-11-13)++Support hashable 1.4++### 1.0.0.6 (2021-09-26)++Add a test suite++### 1.0.0.4 (2021-02-10)++Support GHC 9.0++### 1.0.0.2 (2020-05-18)++Support GHC 8.10++### 1.0.0.0 (2020-05-05)++Initial release
library/ASCII/Case.hs view
@@ -1,6 +1,7 @@ {- | -/Case/ is a property of letters. /A-Z/ are /upper case/ letters, and /a-z/ are /lower case/ letters. No other ASCII characters have case.+/Case/ is a property of letters. /A-Z/ are /upper case/ letters, and+/a-z/ are /lower case/ letters. No other ASCII characters have case.  -} 
+ readme.md view
@@ -0,0 +1,2 @@+This package defines a `Case` type that describes the two varieties of ASCII+letter: capital and small.
test/Main.hs view
@@ -4,51 +4,34 @@  import ASCII.Char (Char (..)) -import Control.Applicative (Applicative (..))-import Control.Monad (Monad (..)) import Data.Bool (Bool (..))-import Data.Eq (Eq ((==)))-import Data.Function (($), (.))-import Data.Functor (Functor (..))-import Data.List (intercalate, map, null)+import Data.Function (($)) import Data.Maybe (Maybe (..))-import Data.Semigroup ((<>))-import Numeric.Natural (Natural)-import System.Exit (die)-import System.IO (IO, putStrLn)-import Text.Show (show)+import System.IO (IO)+import Test.Hspec (hspec, it, shouldBe)  main :: IO ()-main = dieIfFailures $ do-    test 1 $ map letterCase [CapitalLetterR, SmallLetterR, DollarSign] == [Just UpperCase, Just LowerCase,Nothing]-    test 2 $ map (isCase UpperCase) [CapitalLetterR, SmallLetterR, DollarSign] == [True, False, False]-    test 3 $ toCase UpperCase SmallLetterX == CapitalLetterX-    test 4 $ toCase LowerCase CapitalLetterF == SmallLetterF-    test 5 $ toCase UpperCase CapitalLetterA == CapitalLetterA-    test 6 $ toCase UpperCase ExclamationMark == ExclamationMark+main = hspec $ do -dieIfFailures :: Failures a -> IO a-dieIfFailures (Failures fs x) =-    if null fs-        then do putStrLn "💯"; return x-        else die $ intercalate " " (map (("🔥" <> ) . show) fs)+    it "letterCase" $ do+        let f = letterCase+        f CapitalLetterR `shouldBe` Just UpperCase+        f SmallLetterR `shouldBe` Just LowerCase+        f DollarSign `shouldBe` Nothing -type TestNumber = Natural -test :: TestNumber -> Bool -> Failures ()-test n t = Failures (if t then [] else [n]) ()--data Failures a = Failures [TestNumber] a--instance Functor Failures-  where-    fmap f (Failures a x) = Failures a (f x)+    it "isCase UpperCase" $ do+        let f = isCase UpperCase+        f CapitalLetterR `shouldBe` True+        f SmallLetterR `shouldBe` False+        f DollarSign `shouldBe` False -instance Applicative Failures-  where-    pure x = Failures [] x-    Failures a f <*> Failures b x = Failures (a <> b) (f x)+    it "toCase UpperCase" $ do+        let f = toCase UpperCase+        f SmallLetterX `shouldBe` CapitalLetterX+        f CapitalLetterA `shouldBe` CapitalLetterA+        f ExclamationMark `shouldBe` ExclamationMark -instance Monad Failures-  where-    Failures a x >>= f = let Failures b y = f x in Failures (a <> b) y+    it "toCase LowerCase" $ do+        let f = toCase LowerCase+        f CapitalLetterF `shouldBe` SmallLetterF