tibetan-utils 0.1.1.10 → 0.1.2.0
raw patch · 4 files changed
+33/−26 lines, 4 filesdep ~megaparsecPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: megaparsec
API changes (from Hackage documentation)
+ Text.Megaparsec.Lexer.Tibetan: readBoV :: Integral a => String -> Either (ParseErrorBundle String Void) a
Files
- src/Text/Megaparsec/Lexer/Tibetan.hs +6/−3
- src/TextShow/Data/Integral/Tibetan.hs +5/−3
- test/Spec.hs +1/−0
- tibetan-utils.cabal +21/−20
src/Text/Megaparsec/Lexer/Tibetan.hs view
@@ -5,6 +5,7 @@ module Text.Megaparsec.Lexer.Tibetan ( parseNumber , readBo+ , readBoV ) where import Control.Composition@@ -21,12 +22,14 @@ -- | Read a string in, returning integral value or error ----- > λ > readBo "༣༢༠༥"+-- > λ:> readBo "༣༢༠༥" -- > Just 3205 readBo :: (Integral a) => String -> Maybe a-readBo = fmap fromIntegral . rightToMaybe . runParser (parseNumber :: Parser Integer) ""+readBo = rightToMaybe . readBoV -- | Return verbose errors.+--+-- @since 0.1.2.0 readBoV :: (Integral a) => String -> Either (ParseErrorBundle String Void) a readBoV = fmap fromIntegral . runParser (parseNumber :: Parser Integer) "" @@ -38,7 +41,7 @@ -- | Parse a single digit parseNumeral :: (Integral a, MonadParsec e s m, Token s ~ Char) => m a-parseNumeral = foldr (<|>) (parseDigit '༠' 0) $ zipWith parseDigit "༠༡༢༣༤༥༦༧༨༩" (0:[1..9])+parseNumeral = foldr (<|>) (parseDigit '༠' 0) $ zipWith parseDigit "༠༡༢༣༤༥༦༧༨༩" [0..9] -- | m a given char as a given integer parseDigit :: (Integral a, MonadParsec e s m, Token s ~ Char) => Char -> a -> m a
src/TextShow/Data/Integral/Tibetan.hs view
@@ -1,13 +1,15 @@+{-# LANGUAGE OverloadedStrings #-}+ -- | Module to display positive integral values as strings module TextShow.Data.Integral.Tibetan ( builderBo , showBo) where -import qualified Data.Text.Lazy as TL-import Data.Text.Lazy.Builder (Builder, toLazyText, fromLazyText)+import qualified Data.Text.Lazy as TL+import Data.Text.Lazy.Builder (Builder, fromLazyText, toLazyText) -- | Display positive integer as a `String` ----- > λ > showBo 312+-- > λ:> showBo 312 -- > Just "༣༡༢" showBo :: Integer -> Maybe String showBo = fmap (TL.unpack.toLazyText) . builderBo
test/Spec.hs view
@@ -1,3 +1,4 @@+-- vim: syntax=hspec {-# LANGUAGE OverloadedStrings #-} import qualified Data.Text as T
tibetan-utils.cabal view
@@ -1,21 +1,21 @@-cabal-version: >=1.10-name: tibetan-utils-version: 0.1.1.10-license: BSD3-license-file: LICENSE-copyright: Copyright: (c) 2016-2019 Vanessa McHale-maintainer: vamchale@gmail.com-author: Vanessa McHale-synopsis: Parse and display tibetan numerals+cabal-version: >=1.10+name: tibetan-utils+version: 0.1.2.0+license: BSD3+license-file: LICENSE+copyright: Copyright: (c) 2016-2019 Vanessa McHale+maintainer: vamchale@gmail.com+author: Vanessa McHale+synopsis: Parse and display tibetan numerals description: This package provides a [megaparsec](http://hackage.haskell.org/package/megaparsec) parser for Tibetan numerals, as well as efficient means to display numbers using Tibetan numerals.-category: Web-build-type: Simple-extra-source-files:- README.md +category: Web+build-type: Simple+extra-source-files: README.md+ source-repository head- type: git+ type: git location: https://github.com/vmchale/tibetan-utils library@@ -23,9 +23,10 @@ Text.Megaparsec.Lexer.Tibetan Text.Megaparsec.Char.Tibetan TextShow.Data.Integral.Tibetan- hs-source-dirs: src++ hs-source-dirs: src default-language: Haskell2010- default-extensions: OverloadedStrings+ other-extensions: FlexibleContexts OverloadedStrings TypeFamilies build-depends: base >=4.8 && <5, megaparsec >=7.0,@@ -33,11 +34,11 @@ composition-prelude -any test-suite tibetan-utils-test- type: exitcode-stdio-1.0- main-is: Spec.hs- hs-source-dirs: test+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs: test default-language: Haskell2010- ghc-options: -threaded -rtsopts -with-rtsopts=-N+ ghc-options: -threaded -rtsopts "-with-rtsopts=-N -K1K" build-depends: base -any, tibetan-utils -any,