packages feed

validity-text 0.2.0.1 → 0.3.0.0

raw patch · 2 files changed

+20/−32 lines, 2 filesdep ~validity

Dependency ranges changed: validity

Files

src/Data/Validity/Text.hs view
@@ -20,35 +20,23 @@ #endif -- | A text is valid if the internal structure is consistent. instance Validity Text where-    isValid t@(Text arr off len) =-        and-            [ len >= 0-            , off >= 0-            , let c = A.unsafeIndex arr off-              in len == 0 || c < 0xDC00 || c > 0xDFFF-                 -- It contains a valid UTF16-            , (== (Right t :: Either E.UnicodeException Text)) $-              U.unsafeDupablePerformIO .-              try .-              evaluate .-              E.decodeUtf16LEWith E.strictDecode .-              LB.toStrict . SBB.toLazyByteString . mconcat . map SBB.word16LE $-              A.toList arr off len-            ]     validate t@(Text arr off len) =         mconcat-            [ len >= 0 <?@> "The length is positive."-            , off >= 0 <?@> "The offset is positive."-            , (let c = A.unsafeIndex arr off-               in len == 0 || c < 0xDC00 || c > 0xDFFF) <?@>-              "The offset character is valid UTF16."+            [ check (len >= 0) "The length is positive."+            , check (off >= 0) "The offset is positive."+            , check+                  (let c = A.unsafeIndex arr off+                    in len == 0 || c < 0xDC00 || c > 0xDFFF)+                  "The offset character is valid UTF16."                  -- It contains a valid UTF16-            , ((== (Right t :: Either E.UnicodeException Text)) $-               U.unsafeDupablePerformIO .-               try .-               evaluate .-               E.decodeUtf16LEWith E.strictDecode .-               LB.toStrict . SBB.toLazyByteString . mconcat . map SBB.word16LE $-               A.toList arr off len) <?@>-              "The bytes can correctly be decoded as UTF16."+            , check+                  ((== (Right t :: Either E.UnicodeException Text)) $+                   U.unsafeDupablePerformIO .+                   try .+                   evaluate .+                   E.decodeUtf16LEWith E.strictDecode .+                   LB.toStrict .+                   SBB.toLazyByteString . mconcat . map SBB.word16LE $+                   A.toList arr off len)+                  "The bytes can correctly be decoded as UTF16."             ]
validity-text.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 66d567970429991c7e4fb8b53812a651f3021bf8947373e7ed3f41d45334976a+-- hash: 5b72700811415650dc544622be54d4f21b4489ff8e65d51e1642c458f7806333  name:           validity-text-version:        0.2.0.1+version:        0.3.0.0 synopsis:       Validity instances for text description:    Please see README.md category:       Web@@ -13,7 +13,7 @@ bug-reports:    https://github.com/NorfairKing/validity/issues author:         Tom Sydney Kerckhove maintainer:     syd.kerckhove@gmail.com-copyright:      Copyright: (c) 2016 Tom Sydney Kerckhove+copyright:      Copyright: (c) 2016-2018 Tom Sydney Kerckhove license:        MIT license-file:   LICENSE build-type:     Simple@@ -30,7 +30,7 @@       base >=4.7 && <5     , bytestring     , text-    , validity >=0.4 && <0.5+    , validity >=0.5 && <0.6   exposed-modules:       Data.Validity.Text   other-modules: