yaml-light-lens 0.3.1.10 → 0.3.2
raw patch · 2 files changed
+11/−11 lines, 2 filesdep ~bytestring-lexing
Dependency ranges changed: bytestring-lexing
Files
src/Data/Yaml/YamlLight/Lens.hs view
@@ -12,8 +12,8 @@ import Control.Lens import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as BC-import Data.ByteString.Lex.Integral-import Data.ByteString.Lex.Double+import qualified Data.ByteString.Lex.Integral as I+import qualified Data.ByteString.Lex.Fractional as F import Data.Map (Map) import qualified Data.Map as Map import Data.Traversable (sequenceA)@@ -62,12 +62,12 @@ -- | Try to parse an 'Integral' value from a 'YamlLight'. yamlInt :: Integral b => YamlLight -> Maybe b-yamlInt (YStr s) = readSigned readDecimal s >>= noRemainder+yamlInt (YStr s) = I.readSigned I.readDecimal s >>= noRemainder yamlInt _ = Nothing --- | Try to parse a 'Double' from a 'YamlLight'.-yamlReal :: YamlLight -> Maybe Double-yamlReal (YStr s) = readDouble s >>= noRemainder+-- | Try to parse a 'Fractional' value from a 'YamlLight'.+yamlReal :: Fractional b => YamlLight -> Maybe b+yamlReal (YStr s) = F.readSigned F.readDecimal s >>= noRemainder yamlReal _ = Nothing -- | Lens into a sequence.@@ -125,14 +125,14 @@ fromYaml x@(YStr _) = yamlInt x fromYaml _ = Nothing toYaml x = YStr $ if x < 0 then BC.cons '-' bs else bs- where Just bs = packDecimal $ abs x+ where Just bs = I.packDecimal $ abs x -- toYaml = YStr . BC.pack . show instance AsYaml Integer where fromYaml x@(YStr _) = yamlInt x fromYaml _ = Nothing toYaml x = YStr $ if x < 0 then BC.cons '-' bs else bs- where Just bs = packDecimal $ abs x+ where Just bs = I.packDecimal $ abs x -- toYaml = YStr . BC.pack . show instance AsYaml Double where
yaml-light-lens.cabal view
@@ -1,5 +1,5 @@ name: yaml-light-lens-version: 0.3.1.10+version: 0.3.2 synopsis: Lens interface to yaml-light. description: Lenses for working with YAML documents. license: BSD3@@ -20,7 +20,7 @@ exposed-modules: Data.Yaml.YamlLight.Lens build-depends: base >= 4.5 && < 5, bytestring,- bytestring-lexing >= 0.4.3,+ bytestring-lexing >= 0.5.0.2 && < 0.6, containers, lens >= 4.0 && < 4.12, yaml-light >= 0.1 && < 0.2@@ -36,7 +36,7 @@ test-suite doctests type: exitcode-stdio-1.0 main-is: doctests.hs- ghc-options: -Wall -Werror -threaded+ ghc-options: -Wall -threaded hs-source-dirs: tests default-language: Haskell2010 build-depends: