boomerang 1.4.9.4 → 1.4.9.5
raw patch · 6 files changed
+39/−17 lines, 6 filesdep ~template-haskell
Dependency ranges changed: template-haskell
Files
- Text/Boomerang/Error.hs +6/−0
- Text/Boomerang/Prim.hs +3/−0
- Text/Boomerang/Strings.hs +3/−2
- Text/Boomerang/TH.hs +14/−8
- Text/Boomerang/Texts.hs +3/−2
- boomerang.cabal +10/−5
Text/Boomerang/Error.hs view
@@ -2,9 +2,13 @@ {-# LANGUAGE CPP, DeriveDataTypeable, TypeFamilies #-} module Text.Boomerang.Error where +-- mtl is a dependency only with GHC < 9.6 (boomerang.cabal), and+-- MIN_VERSION_mtl is defined only when it is+#if defined(MIN_VERSION_mtl) #if !MIN_VERSION_mtl(2,3,0) import Control.Monad.Error (Error(..)) #endif+#endif import Data.Data (Data, Typeable) import Data.List (intercalate, sort, nub) import Text.Boomerang.Prim@@ -41,9 +45,11 @@ listMsg s = [ParserError Nothing (Other s)] -} +#if defined(MIN_VERSION_mtl) #if !MIN_VERSION_mtl(2,3,0) instance Error (ParserError p) where strMsg s = ParserError Nothing [Message s]+#endif #endif -- | lift a 'pos' and '[ErrorMsg]' into a parse error
Text/Boomerang/Prim.hs view
@@ -44,6 +44,9 @@ GT -> xs EQ -> (y:xs) LT -> [y]+ -- not reached: the fold starts with [x], and each case above is+ -- not empty+ maxBy [] y = [y] -- |Yet another parser. --
Text/Boomerang/Strings.hs view
@@ -146,8 +146,9 @@ (p:ps) -> case reads p of [] -> mkParserError pos [SysUnExpect p, Message $ "decoding using 'read' failed."]- [(a,r)] ->- [Right ((a, r:ps), incMinor ((length p) - (length r)) pos)]+ -- each parse 'reads' gives (one, unless the Read instance+ -- is ambiguous) is a possible parse+ parses -> [ Right ((a, r:ps), incMinor ((length p) - (length r)) pos) | (a, r) <- parses ] readIntegral :: (Read a, Eq a, Num a, Real a) => String -> a readIntegral s =
Text/Boomerang/TH.hs view
@@ -6,6 +6,7 @@ ) where import Control.Monad (liftM, replicateM)+import Data.List (intercalate) import Language.Haskell.TH import Language.Haskell.TH.Datatype.TyVarBndr import Text.Boomerang.HStack ((:-)(..), arg)@@ -52,7 +53,7 @@ NormalC name tys -> go name (map snd tys) RecC name tys -> go name (map (\(_,_,ty) -> ty) tys) _ -> do- runIO $ putStrLn $ "Skipping unsupported constructor " ++ show (conName con)+ runIO $ putStrLn $ "Skipping unsupported constructor " ++ intercalate ", " (map show (conNames con)) return [] where go name tys = do@@ -119,14 +120,19 @@ mkBoomerangName name = mkName ('r' : nameBase name) --- Retrieve the name of a constructor.-conName :: Con -> Name-conName con =+-- Retrieve the names of a constructor (a GADT-syntax one may declare+-- several at once).+conNames :: Con -> [Name]+conNames con = case con of- NormalC name _ -> name- RecC name _ -> name- InfixC _ name _ -> name- ForallC _ _ con' -> conName con'+ NormalC name _ -> [name]+ RecC name _ -> [name]+ InfixC _ name _ -> [name]+ ForallC _ _ con' -> conNames con'+#if MIN_VERSION_template_haskell(2,11,0)+ GadtC names _ _ -> names+ RecGadtC names _ _ -> names+#endif conPCompat :: Name -> [Pat] -> Pat conPCompat n pats = ConP n
Text/Boomerang/Texts.hs view
@@ -149,8 +149,9 @@ (p:ps) -> case reads (Text.unpack p) of [] -> mkParserError pos [SysUnExpect (Text.unpack p), Message $ "decoding using 'read' failed."]- [(a,r)] ->- [Right ((a, (Text.pack r):ps), incMinor ((Text.length p) - (length r)) pos)]+ -- each parse 'reads' gives (one, unless the Read instance+ -- is ambiguous) is a possible parse+ parses -> [ Right ((a, (Text.pack r):ps), incMinor ((Text.length p) - (length r)) pos) | (a, r) <- parses ] readIntegral :: (Integral a) => Text -> a readIntegral s =
boomerang.cabal view
@@ -1,5 +1,5 @@ Name: boomerang-Version: 1.4.9.4+Version: 1.4.9.5 License: BSD3 License-File: LICENSE Author: jeremy@seereason.com@@ -10,16 +10,21 @@ Description: Specify a single unified grammar which can be used for parsing and pretty-printing Cabal-Version: >= 1.10 Build-type: Simple-tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC==9.2.5, GHC==9.4.8, GHC==9.6.4, GHC==9.8.2, GHC==9.10.1+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC==9.2.5, GHC==9.4.8, GHC==9.6.4, GHC==9.8.2, GHC==9.10.1, GHC==9.14.1 Library Default-Language: Haskell2010 Build-Depends: base >= 4 && < 5,- mtl >= 2.0 && < 2.4,- semigroups >= 0.16 && < 0.21,- template-haskell < 2.23,+ template-haskell < 2.25, text >= 0.11 && < 2.2, th-abstraction >= 0.4 && < 0.8+ -- Data.Semigroup is in base from 4.9 (GHC 8.0)+ if !impl(ghc >= 8.0)+ Build-Depends: semigroups >= 0.16 && < 0.21+ -- only for Control.Monad.Error's Error class, which mtl 2.3+ -- (GHC 9.6's) no longer has+ if !impl(ghc >= 9.6)+ Build-Depends: mtl >= 2.0 && < 2.4 Exposed-Modules: Text.Boomerang Text.Boomerang.Combinators Text.Boomerang.Error