packages feed

tibetan-utils 0.1.1.4 → 0.1.1.5

raw patch · 6 files changed

+85/−68 lines, 6 filesdep +composition-preludedep −compositiondep ~text-showPVP ok

version bump matches the API change (PVP)

Dependencies added: composition-prelude

Dependencies removed: composition

Dependency ranges changed: text-show

API changes (from Hackage documentation)

Files

+ cabal.project.local view
@@ -0,0 +1,2 @@+documentation: true+tests: true
src/Text/Megaparsec/Lexer/Tibetan.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeFamilies     #-}  -- | Parser to parse Tibetan numerals module Text.Megaparsec.Lexer.Tibetan@@ -7,25 +7,25 @@     , readBo     ) where -import Data.Void-import Data.Composition-import Data.Either.Combinators-import qualified Data.Text as T-import Text.Megaparsec-import Text.Megaparsec.Char-import System.Environment-import Text.Megaparsec.Char.Tibetan+import           Control.Composition+import           Data.Either.Combinators+import qualified Data.Text                    as T+import           Data.Void+import           System.Environment+import           Text.Megaparsec+import           Text.Megaparsec.Char+import           Text.Megaparsec.Char.Tibetan  -- | Read a string in, returning integral value or error -- -- > λ > readBo "༣༢༠༥" -- > Just 3205 readBo :: (Integral a) => String -> Maybe a-readBo = fmap fromIntegral . rightToMaybe . (runParser (parseNumber :: Parser Integer) "")+readBo = fmap fromIntegral . rightToMaybe . runParser (parseNumber :: Parser Integer) ""  -- | Return verbose errors. readBoV :: (Integral a) => String -> Either (ParseError Char Void) a-readBoV = fmap fromIntegral . (runParser (parseNumber :: Parser Integer) "")+readBoV = fmap fromIntegral . runParser (parseNumber :: Parser Integer) ""  -- | Parse Tibetan numerals, returning a positive integer parseNumber :: (Integral a, MonadParsec e s m, Token s ~ Char) => m a
src/TextShow/Data/Integral/Tibetan.hs view
@@ -3,20 +3,20 @@                                       , showBo) where  import qualified Data.Text.Lazy as TL-import TextShow+import           TextShow  -- | Display positive integer as a `String` -- -- > λ > showBo 312 -- > Just "༣༡༢" showBo :: Integer -> Maybe String-showBo = (fmap toString) . builderBo+showBo = fmap toString . builderBo  -- | show a positive intgeger as text, return `Nothing` if that doesn't work builderBo :: (Integral a) => a -> Maybe Builder builderBo int-    | int >= 0  = Just . fromLazyText $ foldr (.) (id) -        (zipWith TL.replace +    | int >= 0  = Just . fromLazyText $ foldr (.) id+        (zipWith TL.replace             (map showT [0..9])             ["༠","༡","༢","༣","༤","༥","༦","༧","༨","༩"])         (showT (fromIntegral int :: Integer))
+ stack.yaml view
@@ -0,0 +1,8 @@+---+resolver: lts-11.3+packages:+  - '.'+extra-deps:+  - composition-prelude-1.3.0.8+flags: {}+extra-package-dbs: []
test/Spec.hs view
@@ -1,28 +1,28 @@ {-# LANGUAGE OverloadedStrings #-} -import Test.Hspec-import Test.Hspec.Megaparsec-import Text.Megaparsec.Lexer.Tibetan-import Text.Megaparsec-import Text.Megaparsec.Text-import TextShow.Data.Integral.Tibetan-import qualified Data.Text as T+import qualified Data.Text                      as T+import           Test.Hspec+import           Test.Hspec.Megaparsec+import           Text.Megaparsec+import           Text.Megaparsec.Char.Tibetan+import           Text.Megaparsec.Lexer.Tibetan+import           TextShow.Data.Integral.Tibetan  main :: IO () main = hspec $ do     describe "parseNumber" $ do         it "parses Tibetan numerals as an Int" $-            (runParser (parseNumber :: Parser Integer) "") tibStr `shouldParse` 6320+            runParser (parseNumber :: Parser Integer) "" tibStr `shouldParse` 6320         it "fails when given a character that isn't a tibetan numeral" $-            (runParser (parseNumber :: Parser Integer) "") `shouldFailOn` otherStr+            runParser (parseNumber :: Parser Integer) "" `shouldFailOn` otherStr     describe "showBo" $ do         it "displays a positive integer using tibetan numerals" $-            showBo 15 `shouldBe` Just ("༡༥")+            showBo 15 `shouldBe` Just "༡༥"         it "fails on negative inputs" $             showBo (-12) `shouldBe` Nothing -tibStr :: T.Text+tibStr :: String tibStr = "༦༣༢༠" -otherStr :: T.Text+otherStr :: String otherStr = "ཨ་ནི"
tibetan-utils.cabal view
@@ -1,45 +1,52 @@-name:                tibetan-utils-version:             0.1.1.4-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+cabal-version: >=1.10+name: tibetan-utils+version: 0.1.1.5+license: BSD3+license-file: LICENSE+copyright: Copyright: (c) 2016-2018 Vanessa McHale+maintainer: vamchale@gmail.com+author: Vanessa McHale+homepage: https://github.com/vmchale/tibetan-utils#readme+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+    cabal.project.local+    stack.yaml +source-repository head+    type: git+    location: https://github.com/vmchale/tibetan-utils+ library-  hs-source-dirs:      src-  exposed-modules:     Text.Megaparsec.Lexer.Tibetan-                     , Text.Megaparsec.Char.Tibetan-                     , TextShow.Data.Integral.Tibetan-  build-depends:       base >= 4.8 && < 5-                     , megaparsec >= 6.0-                     , text-                     , composition-                     , text-show-                     , either-  default-language:    Haskell2010-  default-extensions:  OverloadedStrings+    exposed-modules:+        Text.Megaparsec.Lexer.Tibetan+        Text.Megaparsec.Char.Tibetan+        TextShow.Data.Integral.Tibetan+    hs-source-dirs: src+    default-language: Haskell2010+    default-extensions: OverloadedStrings+    build-depends:+        base >=4.8 && <5,+        megaparsec >=6.0,+        text -any,+        composition-prelude -any,+        text-show -any,+        either -any  test-suite tibetan-utils-test-  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+    type: exitcode-stdio-1.0+    main-is: Spec.hs+    hs-source-dirs: test+    default-language: Haskell2010+    ghc-options: -threaded -rtsopts -with-rtsopts=-N+    build-depends:+        base -any,+        tibetan-utils -any,+        hspec -any,+        hspec-megaparsec -any,+        text -any,+        megaparsec -any