packages feed

ascii-char 1.0.0.15 → 1.0.0.16

raw patch · 4 files changed

+77/−51 lines, 4 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-char.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0  name: ascii-char-version: 1.0.0.15+version: 1.0.0.16 synopsis: A Char type representing an ASCII character 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-char+bug-Reports: https://github.com/typeclasses/ascii-char/issues -build-type: Simple+extra-source-files: *.md  source-repository head     type: git-    location: git://github.com/typeclasses/ascii.git+    location: git://github.com/typeclasses/ascii-char.git  common base     default-language: Haskell2010@@ -32,7 +32,7 @@         NoImplicitPrelude      build-depends:-        base >= 4.13 && < 4.17+        base ^>= 4.14 || ^>= 4.15 || ^>= 4.16 || ^>= 4.17  library     import: base@@ -47,7 +47,7 @@         StandaloneDeriving      build-depends:-        hashable >= 1.3 && < 1.5+        hashable ^>= 1.3.5 || ^>= 1.4      exposed-modules:         ASCII.Char@@ -58,9 +58,6 @@     hs-source-dirs: test     main-is: Main.hs -    default-extensions:-        OverloadedStrings-        QuasiQuotes-     build-depends:         ascii-char+      , hspec ^>= 2.8.5 || ^>= 2.9 || ^>= 2.10
+ changelog.md view
@@ -0,0 +1,39 @@+### 1.0.0.16 (2022-10-04)++Test suite now uses `hspec`++### 1.0.0.15 (2022-10-04)++Drop support for base 4.11 (GHC 8.4) and base 4.12 (GHC 8.6)++### 1.0.0.14 (2022-01-09)++Support GHC 9.2++### 1.0.0.12 (2021-11-13)++Support hashable 1.4++### 1.0.0.10 (2021-09-26)++Add a test suite++### 1.0.0.8 (2021-02-10)++Support GHC 9.0++### 1.0.0.6 (2021-01-27)++Minor documentation fix++### 1.0.0.4 (2021-01-25)++Add some comments++### 1.0.0.2 (2020-05-18)++Support GHC 8.10++### 1.0.0.0 (2020-05-05)++Initial release
+ readme.md view
@@ -0,0 +1,2 @@+This package defines a `Char` type that has 128 constructors, one for each ASCII+character.
test/Main.hs view
@@ -2,52 +2,40 @@  import ASCII.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, length, map, null)+import Data.Function (($))+import Data.List (length) import Data.Maybe (Maybe (..))-import Data.Semigroup ((<>))-import Numeric.Natural (Natural) import Prelude (maxBound, minBound)-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 toInt [Null, CapitalLetterA, SmallLetterA, Delete] == [0, 65, 97, 127]-    test 2 $ map fromIntMaybe [-1, 0, 65, 127, 128] == [Nothing, Just Null, Just CapitalLetterA, Just Delete, Nothing]-    test 3 $ map fromIntUnsafe [65, 66, 67] == [CapitalLetterA, CapitalLetterB, CapitalLetterC]-    test 4 $ length allCharacters == 128-    test 5 $ (minBound :: Char) == Null-    test 6 $ (maxBound :: Char) == Delete--dieIfFailures :: Failures a -> IO a-dieIfFailures (Failures fs x) =-    if null fs-        then do putStrLn "💯"; return x-        else die $ intercalate " " (map (("🔥" <> ) . show) fs)--type TestNumber = Natural+main = hspec $ do -test :: TestNumber -> Bool -> Failures ()-test n t = Failures (if t then [] else [n]) ()+    it "toInt" $ do+        let f = toInt+        f Null `shouldBe` 0+        f CapitalLetterA `shouldBe` 65+        f SmallLetterA `shouldBe` 97+        f Delete `shouldBe` 127 -data Failures a = Failures [TestNumber] a+    it "fromIntMaybe" $ do+        let f = fromIntMaybe+        f (-1) `shouldBe` Nothing+        f 0 `shouldBe` Just Null+        f 65 `shouldBe` Just CapitalLetterA+        f 127 `shouldBe` Just Delete+        f 128 `shouldBe` Nothing -instance Functor Failures-  where-    fmap f (Failures a x) = Failures a (f x)+    it "fromIntUnsafe" $ do+        let f = fromIntUnsafe+        f 65 `shouldBe` CapitalLetterA+        f 66 `shouldBe` CapitalLetterB+        f 67 `shouldBe` CapitalLetterC -instance Applicative Failures-  where-    pure x = Failures [] x-    Failures a f <*> Failures b x = Failures (a <> b) (f x)+    it "allCharacters" $ do+        length allCharacters `shouldBe` 128 -instance Monad Failures-  where-    Failures a x >>= f = let Failures b y = f x in Failures (a <> b) y+    it "Bounded" $ do+        minBound `shouldBe` Null+        maxBound `shouldBe` Delete