tibetan-utils 0.1.1.2 → 0.1.1.3
raw patch · 5 files changed
+58/−56 lines, 5 filesdep ~basedep ~compositiondep ~eitherPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: base, composition, either, hspec, hspec-megaparsec, megaparsec, text, text-show, tibetan-utils
API changes (from Hackage documentation)
+ Text.Megaparsec.Char.Tibetan: type Parser = Parsec Void String
Files
- README.md +3/−0
- src/Text/Megaparsec/Char/Tibetan.hs +6/−3
- src/Text/Megaparsec/Lexer/Tibetan.hs +4/−3
- test/Spec.hs +4/−4
- tibetan-utils.cabal +41/−46
README.md view
@@ -3,3 +3,6 @@ Haskell library (with test suite) to parse Tibetan numerals as integers and display integers as tibetan numerals. See [Text.Megaparsec](https://hackage.haskell.org/package/megaparsec) documentation for how to use the parser.++There is an Idris version of this library in-progress+[here](https://github.com/vmchale/tibetan_utils).
src/Text/Megaparsec/Char/Tibetan.hs view
@@ -1,12 +1,15 @@ module Text.Megaparsec.Char.Tibetan where -import Text.Megaparsec-import Text.Megaparsec.Text+import Data.Void+import Text.Megaparsec+import Text.Megaparsec.Char +type Parser = Parsec Void String+ -- | Parse a consonant consonantCharBo :: Parser Char consonantCharBo = oneOf ("ཨཅཆརཏཡཕཙཚཛའསདབངམགལཞཟཤཀཁཔནཐཇཉཝཧ" :: String) --- | Parse a digit as a char. +-- | Parse a digit as a char. digitCharBo :: Parser Char digitCharBo = oneOf ("༠༡༢༣༤༥༦༧༨༩" :: String) <?> "digit char"
src/Text/Megaparsec/Lexer/Tibetan.hs view
@@ -7,13 +7,14 @@ , readBo ) where +import Data.Void import Data.Composition import Data.Either.Combinators import qualified Data.Text as T import Text.Megaparsec-import Text.Megaparsec.String-import Text.Megaparsec.Prim+import Text.Megaparsec.Char import System.Environment+import Text.Megaparsec.Char.Tibetan -- | Read a string in, returning integral value or error --@@ -23,7 +24,7 @@ readBo = fmap fromIntegral . rightToMaybe . (runParser (parseNumber :: Parser Integer) "") -- | Return verbose errors.-readBoV :: (Integral a) => String -> Either (ParseError Char Dec) a+readBoV :: (Integral a) => String -> Either (ParseError Char Void) a readBoV = fmap fromIntegral . (runParser (parseNumber :: Parser Integer) "") -- | Parse Tibetan numerals, returning a positive integer
test/Spec.hs view
@@ -11,14 +11,14 @@ main :: IO () main = hspec $ do describe "parseNumber" $ do- it "parses Tibetan numerals as an Int" $ do+ it "parses Tibetan numerals as an Int" $ (runParser (parseNumber :: Parser Integer) "") tibStr `shouldParse` 6320- it "fails when given a character that isn't a tibetan numeral" $ do+ it "fails when given a character that isn't a tibetan numeral" $ (runParser (parseNumber :: Parser Integer) "") `shouldFailOn` otherStr describe "showBo" $ do- it "displays a positive integer using tibetan numerals" $ do+ it "displays a positive integer using tibetan numerals" $ showBo 15 `shouldBe` Just ("༡༥")- it "fails on negative inputs" $ do+ it "fails on negative inputs" $ showBo (-12) `shouldBe` Nothing tibStr :: T.Text
tibetan-utils.cabal view
@@ -1,50 +1,45 @@-name: tibetan-utils-version: 0.1.1.2-cabal-version: >=1.10-build-type: Simple-license: BSD3-license-file: LICENSE-copyright: Copyright: (c) 2016 Vanessa McHale-maintainer: tmchale@wisc.edu-homepage: https://github.com/vmchale/tibetan-utils#readme-synopsis: Parse and display tibetan numerals-description:- Please see README.md-category: Web-author: Vanessa McHale-extra-source-files:- README.md--source-repository head- type: git- location: https://github.com/vmchale/tibetan-utils+name: tibetan-utils+version: 0.1.1.3+synopsis: Parse and display tibetan numerals+description: Please see README.md+homepage: https://github.com/vmchale/tibetan-utils#readme+license: BSD3+license-file: LICENSE+author: Vanessa McHale+maintainer: tmchale@wisc.edu+copyright: Copyright: (c) 2016 Vanessa McHale+category: Web+build-type: Simple+extra-source-files: README.md+cabal-version: >=1.10 library- exposed-modules:- Text.Megaparsec.Lexer.Tibetan- Text.Megaparsec.Char.Tibetan- TextShow.Data.Integral.Tibetan- build-depends:- base >=4.7 && <5,- megaparsec >=5.2.0 && <5.3,- text >=1.2.2.1 && <1.3,- composition >=1.0.2.1 && <1.1,- text-show >=3.4.1.1 && <3.5,- either >=4.4.1.1 && <4.5- default-language: Haskell2010- default-extensions: OverloadedStrings- hs-source-dirs: src+ hs-source-dirs: src+ exposed-modules: Text.Megaparsec.Lexer.Tibetan+ , Text.Megaparsec.Char.Tibetan+ , TextShow.Data.Integral.Tibetan+ build-depends: base >= 4.7 && < 5+ , megaparsec >= 6.0+ , text+ , composition+ , text-show+ , either+ default-language: Haskell2010+ default-extensions: OverloadedStrings test-suite tibetan-utils-test- type: exitcode-stdio-1.0- main-is: Spec.hs- build-depends:- base >=4.9.1.0 && <4.10,- tibetan-utils >=0.1.1.2 && <0.2,- hspec >=2.4.2 && <2.5,- hspec-megaparsec >=0.3.1 && <0.4,- text >=1.2.2.1 && <1.3,- megaparsec >=5.2.0 && <5.3- default-language: Haskell2010- hs-source-dirs: test- ghc-options: -threaded -rtsopts -with-rtsopts=-N+ type: exitcode-stdio-1.0+ hs-source-dirs: test+ main-is: Spec.hs+ build-depends: base+ , tibetan-utils+ , hspec+ , hspec-megaparsec+ , text+ , megaparsec+ ghc-options: -threaded -rtsopts -with-rtsopts=-N+ default-language: Haskell2010++source-repository head+ type: git+ location: https://github.com/vmchale/tibetan-utils