packages feed

validity-text 0.1.0.1 → 0.1.1.0

raw patch · 3 files changed

+45/−34 lines, 3 filessetup-changedPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Setup.hs view
@@ -1,2 +1,3 @@ import Distribution.Simple+ main = defaultMain
src/Data/Validity/Text.hs view
@@ -1,19 +1,26 @@+{-# OPTIONS_GHC -Wno-orphans #-}+ module Data.Validity.Text where -import           Data.Validity+import Data.Validity -import           Data.Text.Internal (Text(..)) import qualified Data.Text.Array as A+import Data.Text.Internal (Text(..))+import qualified Data.Text.Internal.Encoding.Utf16 as E  -- | A text is valid if the internal structure is consistent. instance Validity Text where     isValid (Text arr off len) =-        let c    = A.unsafeIndex arr off-        in    (len >= 0)-           && (off >= 0)-           -- TODO(syd) also check the length of the byte array if that is-           -- possible. Like this:-           -- && (alen == 0 || len == 0 || off < alen)-           && (len == 0 || c < 0xDC00 || c > 0xDFFF)--+        let c = A.unsafeIndex arr off+        in and+               [ len >= 0+               , off >= 0+               , len == 0 || c < 0xDC00 || c > 0xDFFF+               , let ws = A.toList arr off len -- Checking for failures while decoding the UTFX+                 in all E.validate1 ws && all (uncurry E.validate2) (tupsOf ws)+               ]+      where+        tupsOf :: [a] -> [(a, a)]+        tupsOf [] = []+        tupsOf [_] = []+        tupsOf (a:b:rs) = (a, b) : tupsOf rs
validity-text.cabal view
@@ -1,26 +1,29 @@-name:                validity-text-version:             0.1.0.1-synopsis:            Validity instances for text-description:         Please see README.md-homepage:            https://github.com/NorfairKing/validity#readme-license:             MIT-license-file:        LICENSE-author:              Tom Sydney Kerckhove-maintainer:          syd.kerckhove@gmail.com-copyright:           Copyright: (c) 2016 Tom Sydney Kerckhove-category:            Web-build-type:          Simple--- extra-source-files:-cabal-version:       >=1.10+name: validity-text+version: 0.1.1.0+cabal-version: >=1.10+build-type: Simple+license: MIT+license-file: LICENSE+copyright: Copyright: (c) 2016 Tom Sydney Kerckhove+maintainer: syd.kerckhove@gmail.com+homepage: https://github.com/NorfairKing/validity#readme+synopsis: Validity instances for text+description:+    Please see README.md+category: Web+author: Tom Sydney Kerckhove +source-repository head+    type: git+    location: https://github.com/NorfairKing/validity+ library-  hs-source-dirs:      src-  exposed-modules:     Data.Validity.Text-  build-depends:       base < 5-                     , validity-                     , text-  default-language:    Haskell2010+    exposed-modules:+        Data.Validity.Text+    build-depends:+        base <5,+        validity -any,+        text -any+    default-language: Haskell2010+    hs-source-dirs: src -source-repository head-  type:     git-  location: https://github.com/NorfairKing/validity