units-parser 0.1.1.4 → 0.1.1.5
raw patch · 4 files changed
+60/−15 lines, 4 filesdep ~containersdep ~mtldep ~multimap
Dependency ranges changed: containers, mtl, multimap, parsec
Files
- CHANGES.md +42/−0
- Tests/Parser.hs +7/−6
- Text/Parse/Units.hs +2/−1
- units-parser.cabal +9/−8
+ CHANGES.md view
@@ -0,0 +1,42 @@+Changelog for `units-parser`+============================++0.1.1.5+-------++Add support for mtl-2.3.1 and hence GHC 9.6, thanks to @RyanGlScott.+Various Cabal file fixes.++0.1.1.4+-------++Fix for simplified subsumption.++0.1.1.3+-------++Fix testsuite to work with GHC 8.4+, thanks to @philderbeast.++0.1.1.2+-------++Bugfix for 7.8.4.++0.1.1.1+-------++Add support for 7.8.4, which didn't auto-derive `Typeable`.++0.1.1+-----++Add `Data` and `Generic` instances where possible, thanks to+@s9gf4ult on GitHub.++0.1.0.1+-------+Fix warning-inducing omission in cabal file.++0.1.0.0+-------+Initial release.
Tests/Parser.hs view
@@ -3,14 +3,15 @@ -} {-# LANGUAGE TemplateHaskell, TypeOperators, CPP #-}--module Tests.Parser where+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}+{-# OPTIONS_GHC -Wno-unused-top-binds #-} import Prelude hiding ( lex, exp ) import Text.Parse.Units -import Control.Monad.Reader+import Control.Monad (liftM)+import Control.Monad.Reader (runReader) import qualified Data.Map.Strict as Map import Text.Parsec import Data.Generics@@ -106,9 +107,9 @@ mkSymbolTableTests = testGroup "mkSymbolTable" [ testCase "Unambiguous1" (Map.keys (prefixTable testSymbolTable) @?= ["d","da","k","m"]) -- , testCase "Unambiguous2" (Map.keys (unitTable testSymbolTable) @?= ["am","m","min","s"])- , testCase "AmbigPrefix" (leftOnly (mkSymbolTable [("a",''Milli),("a",''Centi)] ([] :: [(String,Name)])) @?= Just "The label `a' is assigned to the following meanings:\n[\"Tests.Parser.Milli\",\"Tests.Parser.Centi\"]\nThis is ambiguous. Please fix before building a unit parser.")- , testCase "AmbigUnit" (leftOnly (mkSymbolTable ([] :: [(String,Name)]) [("m",''Meter),("m",''Minute)]) @?= Just "The label `m' is assigned to the following meanings:\n[\"Tests.Parser.Meter\",\"Tests.Parser.Minute\"]\nThis is ambiguous. Please fix before building a unit parser.")- , testCase "MultiAmbig" (leftOnly (mkSymbolTable [("a",''Milli),("b",''Centi),("b",''Deci),("b",''Kilo),("c",''Atto),("c",''Deca)] [("m",''Meter),("m",''Minute),("s",''Second)]) @?= Just "The label `b' is assigned to the following meanings:\n[\"Tests.Parser.Centi\",\"Tests.Parser.Deci\",\"Tests.Parser.Kilo\"]\nThe label `c' is assigned to the following meanings:\n[\"Tests.Parser.Atto\",\"Tests.Parser.Deca\"]\nThis is ambiguous. Please fix before building a unit parser.")+ , testCase "AmbigPrefix" (leftOnly (mkSymbolTable [("a",''Milli),("a",''Centi)] ([] :: [(String,Name)])) @?= Just "The label `a' is assigned to the following meanings:\n[\"Main.Milli\",\"Main.Centi\"]\nThis is ambiguous. Please fix before building a unit parser.")+ , testCase "AmbigUnit" (leftOnly (mkSymbolTable ([] :: [(String,Name)]) [("m",''Meter),("m",''Minute)]) @?= Just "The label `m' is assigned to the following meanings:\n[\"Main.Meter\",\"Main.Minute\"]\nThis is ambiguous. Please fix before building a unit parser.")+ , testCase "MultiAmbig" (leftOnly (mkSymbolTable [("a",''Milli),("b",''Centi),("b",''Deci),("b",''Kilo),("c",''Atto),("c",''Deca)] [("m",''Meter),("m",''Minute),("s",''Second)]) @?= Just "The label `b' is assigned to the following meanings:\n[\"Main.Centi\",\"Main.Deci\",\"Main.Kilo\"]\nThe label `c' is assigned to the following meanings:\n[\"Main.Atto\",\"Main.Deca\"]\nThis is ambiguous. Please fix before building a unit parser.") ] testSymbolTable :: SymbolTable Name Name
Text/Parse/Units.hs view
@@ -52,7 +52,8 @@ import Text.Parsec.Pos import qualified Data.Map.Strict as Map import qualified Data.MultiMap as MM-import Control.Monad.Reader+import Control.Monad (liftM, void)+import Control.Monad.Reader (MonadReader(..), Reader, asks, runReader) import Control.Arrow hiding ( app) import Data.Data (Data) import Data.Maybe
units-parser.cabal view
@@ -1,6 +1,6 @@ name: units-parser-version: 0.1.1.4-cabal-version: >= 1.10+version: 0.1.1.5+cabal-version: 1.18 synopsis: A parser for units of measure category: Text author: Richard Eisenberg <rae@cs.brynmawr.edu>@@ -9,8 +9,9 @@ stability: experimental license: BSD3 license-file: LICENSE+extra-doc-files: CHANGES.md build-type: Simple-tested-with: GHC==9.0.1, GHC==8.10.4, GHC==8.8.4, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3+tested-with: GHC==9.6.1, GHC==9.4.4, GHC==9.2.7 description: The @units-parser@ package provides a parser for unit expressions@@ -24,10 +25,10 @@ library ghc-options: -Wall build-depends: base >= 4.7 && < 5- , mtl >= 1.1- , multimap >= 1.2- , containers >= 0.4- , parsec >= 3+ , mtl >= 1.1 && < 2.4+ , multimap >= 1.2 && < 1.3+ , containers >= 0.4 && < 0.7+ , parsec >= 3 && < 3.2 exposed-modules: Text.Parse.Units @@ -48,4 +49,4 @@ , parsec >= 3 other-modules: Text.Parse.Units - ghc-options: -O0 -Wall -main-is Tests.Parser+ ghc-options: -Wall