trifecta 2.1.1 → 2.1.2
raw patch · 14 files changed
+57/−109 lines, 14 filesdep −faildep −semigroupsdep ~ansi-terminaldep ~arraydep ~base
Dependencies removed: fail, semigroups
Dependency ranges changed: ansi-terminal, array, base, blaze-html, blaze-markup, bytestring, comonad, containers, deepseq, hashable, lens, mtl, prettyprinter, prettyprinter-ansi-terminal, profunctors, reducers, transformers
Files
- CHANGELOG.markdown +6/−0
- examples/trifecta-examples.cabal +4/−4
- src/Text/Trifecta/Delta.hs +2/−5
- src/Text/Trifecta/Highlight.hs +4/−15
- src/Text/Trifecta/Parser.hs +1/−1
- src/Text/Trifecta/Rendering.hs +9/−9
- src/Text/Trifecta/Result.hs +2/−2
- src/Text/Trifecta/Rope.hs +1/−1
- src/Text/Trifecta/Tutorial.hs +1/−1
- src/Text/Trifecta/Util/IntervalMap.hs +0/−8
- src/Text/Trifecta/Util/It.hs +1/−9
- src/Text/Trifecta/Util/Pretty.hs +3/−8
- tests/QuickCheck.hs +0/−15
- trifecta.cabal +23/−31
CHANGELOG.markdown view
@@ -1,3 +1,9 @@+2.1.2 [2021.11.16]+------------------+* Add an `Eq Strand` instance.+* Allow building with `hashable-1.4.*`.+* Drop support for pre-8.0 versions of GHC.+ 2.1.1 [2021.02.18] ------------------ * Allow building with `lens-5.*`.
examples/trifecta-examples.cabal view
@@ -14,14 +14,14 @@ A modern parser combinator library with slicing and Clang-style colored diagnostics cabal-version: >= 1.10 build-type: Simple-tested-with: GHC == 7.8.4- , GHC == 7.10.3- , GHC == 8.0.2+tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4- , GHC == 8.10.3+ , GHC == 8.10.7+ , GHC == 9.0.1+ , GHC == 9.2.1 extra-source-files: RFC2616.txt RFC2616-malformed.txt source-repository head
src/Text/Trifecta/Delta.hs view
@@ -32,15 +32,12 @@ import Data.Int import Data.Data import Data.Word-#if __GLASGOW_HASKELL__ < 710-import Data.Foldable-#endif import Data.Function (on) import Data.FingerTree hiding (empty) import Data.ByteString as Strict hiding (empty) import qualified Data.ByteString.UTF8 as UTF8-import Data.Text.Prettyprint.Doc hiding (column, line') import GHC.Generics+import Prettyprinter hiding (column, line') import Text.Trifecta.Util.Pretty @@ -95,7 +92,7 @@ -- , number of bytes -- , number of bytes since the last newline ) -- @- deriving (Show, Data, Typeable, Generic)+ deriving (Show, Data, Generic) instance Eq Delta where (==) = (==) `on` bytes
src/Text/Trifecta/Highlight.hs view
@@ -2,9 +2,6 @@ {-# language OverloadedStrings #-} {-# language TemplateHaskell #-} -#ifndef MIN_VERSION_lens-#define MIN_VERSION_lens(x,y,z) 1-#endif ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2011-2019 Edward Kmett@@ -25,19 +22,16 @@ , doc ) where -import Control.Lens-#if MIN_VERSION_lens(4,13,0) && __GLASGOW_HASKELL__ >= 710- hiding (Empty)-#endif+import Control.Lens hiding (Empty) import Data.Foldable as F import Data.Int (Int64) import Data.List (sort) import Data.Semigroup import Data.Semigroup.Union-import Data.Text.Prettyprint.Doc-import Data.Text.Prettyprint.Doc.Render.Terminal (color)-import qualified Data.Text.Prettyprint.Doc.Render.Terminal as Pretty import Prelude hiding (head)+import Prettyprinter+import Prettyprinter.Render.Terminal (color)+import qualified Prettyprinter.Render.Terminal as Pretty import Text.Blaze import Text.Blaze.Html5 hiding (a,b,i) import qualified Text.Blaze.Html5 as Html5@@ -109,13 +103,8 @@ | otherwise = unsafeLazyByteString om >> go eb nom es where (om,nom) = L.splitAt (fromIntegral (eb - b)) cs -#if MIN_VERSION_blaze_markup(0,8,0) emptyMarkup = Empty () leafMarkup a b c = Leaf a b c ()-#else- emptyMarkup = Empty- leafMarkup a b c = Leaf a b c-#endif -- | Represents a source file like an HsColour rendered document data HighlightDoc = HighlightDoc
src/Text/Trifecta/Parser.hs view
@@ -51,7 +51,7 @@ import Data.Semigroup.Reducer -- import Data.Sequence as Seq hiding (empty) import Data.Set as Set hiding (empty, toList)-import Data.Text.Prettyprint.Doc as Pretty hiding (line)+import Prettyprinter as Pretty hiding (line) import System.IO import Text.Parser.Combinators import Text.Parser.Char
src/Text/Trifecta/Rendering.hs view
@@ -70,13 +70,13 @@ import Data.Int (Int64) import Data.List (groupBy) import Data.Maybe-import Data.Text.Prettyprint.Doc hiding (column, line')-import Data.Text.Prettyprint.Doc.Render.Terminal (color, bgColor, colorDull, bgColorDull)-import qualified Data.Text.Prettyprint.Doc.Render.Terminal as Pretty import Data.Semigroup import Data.Semigroup.Reducer import GHC.Generics import Prelude as P hiding (span)+import Prettyprinter hiding (column, line')+import Prettyprinter.Render.Terminal (color, bgColor, colorDull, bgColorDull)+import qualified Prettyprinter.Render.Terminal as Pretty import System.Console.ANSI import Text.Trifecta.Delta@@ -86,9 +86,9 @@ -- $setup -- -- >>> :set -XOverloadedStrings--- >>> import Data.Text.Prettyprint.Doc (unAnnotate) -- >>> import Data.ByteString (ByteString) -- >>> import Data.Monoid (mempty)+-- >>> import Prettyprinter (unAnnotate) -- >>> import Text.Trifecta.Delta -- >>> let exampleRendering = rendered mempty ("int main(int argc, char ** argv) { int; }" :: ByteString) @@ -340,7 +340,7 @@ -- >>> unAnnotate (prettyRendering (addCaret (Columns 35 35) exampleRendering)) -- 1 | int main(int argc, char ** argv) { int; }<EOF> -- | ^-data Caret = Caret !Delta {-# UNPACK #-} !ByteString deriving (Eq,Ord,Show,Data,Typeable,Generic)+data Caret = Caret !Delta {-# UNPACK #-} !ByteString deriving (Eq,Ord,Show,Data,Generic) class HasCaret t where caret :: Lens' t Caret@@ -379,7 +379,7 @@ renderingCaret :: Delta -> ByteString -> Rendering renderingCaret d bs = addCaret d $ rendered d bs -data Careted a = a :^ Caret deriving (Eq,Ord,Show,Data,Typeable,Generic)+data Careted a = a :^ Caret deriving (Eq,Ord,Show,Data,Generic) instance HasCaret (Careted a) where caret f (a :^ c) = (a :^) <$> f c@@ -446,7 +446,7 @@ -- >>> unAnnotate (prettyRendering (addSpan (Columns 35 35) (Columns 38 38) exampleRendering)) -- 1 | int main(int argc, char ** argv) { int; }<EOF> -- | ~~~-data Span = Span !Delta !Delta {-# UNPACK #-} !ByteString deriving (Eq,Ord,Show,Data,Typeable,Generic)+data Span = Span !Delta !Delta {-# UNPACK #-} !ByteString deriving (Eq,Ord,Show,Data,Generic) class HasSpan t where span :: Lens' t Span@@ -467,7 +467,7 @@ -- | Annotate an arbitrary piece of data with a 'Span', typically its -- corresponding input location.-data Spanned a = a :~ Span deriving (Eq,Ord,Show,Data,Typeable,Generic)+data Spanned a = a :~ Span deriving (Eq,Ord,Show,Data,Generic) instance HasSpan (Spanned a) where span f (a :~ c) = (a :~) <$> f c@@ -515,7 +515,7 @@ -- ^ 'Span' where the error occurred , _fixitReplacement :: !ByteString -- ^ Replacement suggestion- } deriving (Eq,Ord,Show,Data,Typeable,Generic)+ } deriving (Eq,Ord,Show,Data,Generic) makeClassy ''Fixit
src/Text/Trifecta/Result.hs view
@@ -45,8 +45,8 @@ import Data.Semigroup #endif import Data.Set as Set hiding (empty, toList)-import Data.Text.Prettyprint.Doc as Pretty-import Data.Text.Prettyprint.Doc.Render.Terminal as Pretty+import Prettyprinter as Pretty+import Prettyprinter.Render.Terminal as Pretty import Text.Trifecta.Delta as Delta import Text.Trifecta.Rendering
src/Text/Trifecta/Rope.hs view
@@ -59,7 +59,7 @@ data Strand = Strand {-# UNPACK #-} !ByteString !Delta -- ^ Data of a certain length | Skipping !Delta -- ^ Absence of data of a certain length- deriving (Show, Data, Typeable, Generic)+ deriving (Eq, Show, Data, Generic) -- | Construct a single 'Strand' out of a 'ByteString'. strand :: ByteString -> Strand
src/Text/Trifecta/Tutorial.hs view
@@ -20,7 +20,7 @@ -- definitions, but it’s useful to keep in mind that the documentation of -- certain functions might not be directly in the /trifecta/ package. importDocumentation :: docDummy-importDocumentation = error "Auxiliary definition to write Haddock documetation for :-)"+importDocumentation = error "Auxiliary definition to write Haddock documentation for :-)" -- | In order to keep things minimal, we define a very simple language for -- arithmetic expressions.
src/Text/Trifecta/Util/IntervalMap.hs view
@@ -52,16 +52,8 @@ , fromList ) where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative hiding (empty)-import Data.Foldable (Foldable (foldMap))-#endif import qualified Data.Foldable.WithIndex as WithIndex-#if MIN_VERSION_lens(4,13,0) && __GLASGOW_HASKELL__ >= 710 import Control.Lens as Lens hiding ((:<), (<|), (|>))-#else-import Control.Lens as Lens hiding ((<|), (|>))-#endif import Data.FingerTree (FingerTree, Measured (..), ViewL (..), (<|), (><)) import qualified Data.FingerTree as FT
src/Text/Trifecta/Util/It.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE BangPatterns #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-}@@ -28,16 +27,9 @@ , sliceIt ) where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Comonad import Control.Monad -#if __GLASGOW_HASKELL__ < 710-import Data.Monoid-#endif- import Data.ByteString as Strict import Data.ByteString.Lazy as Lazy import Data.Profunctor@@ -96,7 +88,7 @@ pure = Pure Pure f <*> Pure a = Pure $ f a Pure f <*> It a ka = It (f a) $ fmap f . ka- It f kf <*> Pure a = It (f a) $ fmap ($a) . kf+ It f kf <*> Pure a = It (f a) $ fmap ($ a) . kf It f kf <*> It a ka = It (f a) $ \r -> kf r <*> ka r indexIt :: It r a -> r -> a
src/Text/Trifecta/Util/Pretty.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2011-2019 Edward Kmett@@ -27,13 +26,9 @@ ) where -#if __GLASGOW_HASKELL__ < 710-import Data.Monoid-#endif--import Data.Text.Prettyprint.Doc-import Data.Text.Prettyprint.Doc.Render.Terminal-import Data.Text.Prettyprint.Doc.Render.Terminal.Internal (ansiBold, ansiUnderlining)+import Prettyprinter+import Prettyprinter.Render.Terminal+import Prettyprinter.Render.Terminal.Internal (ansiBold, ansiUnderlining) char :: Char -> Doc a char = pretty
tests/QuickCheck.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} module Main@@ -7,14 +6,8 @@ import Control.Applicative -#if MIN_VERSION_base(4,7,0) import Data.Either-#endif -#if __GLASGOW_HASKELL__ < 710-import Data.Monoid-#endif- import qualified Test.QuickCheck as Q import Text.Parser.Char@@ -81,11 +74,3 @@ parse p s = case parseString p mempty s of Failure e -> Left (show e) Success a -> Right a--#if !MIN_VERSION_base(4,7,0)-isLeft :: Either a b -> Bool-isLeft = either (const True) (const False)--isRight :: Either a b -> Bool-isRight = either (const False) (const True)-#endif
trifecta.cabal view
@@ -1,6 +1,6 @@ name: trifecta category: Text, Parsing, Diagnostics, Pretty Printer, Logging-version: 2.1.1+version: 2.1.2 license: BSD3 cabal-version: 1.18 license-file: LICENSE@@ -21,14 +21,14 @@ <images/example.png (Local Copy)> build-type: Simple-tested-with: GHC == 7.8.4- , GHC == 7.10.3- , GHC == 8.0.2+tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4- , GHC == 8.10.3+ , GHC == 8.10.7+ , GHC == 9.0.1+ , GHC == 9.2.1 extra-doc-files: images/*.png@@ -67,44 +67,36 @@ build-depends: ansi-terminal >= 0.6 && < 0.12,- array >= 0.3.0.2 && < 0.6,- base >= 4.7 && < 5,+ array >= 0.5.1.1 && < 0.6,+ base >= 4.9 && < 5, blaze-builder >= 0.3.0.1 && < 0.5,- blaze-html >= 0.5 && < 0.10,- blaze-markup >= 0.5 && < 0.9,+ blaze-html >= 0.9 && < 0.10,+ blaze-markup >= 0.8 && < 0.9, bytestring >= 0.9.1 && < 0.12, charset >= 0.3.5.1 && < 1,- comonad >= 4 && < 6,- containers >= 0.3 && < 0.7,- deepseq >= 1.2.0.1 && < 1.5,+ comonad >= 5 && < 6,+ containers >= 0.5.7.0 && < 0.7,+ deepseq >= 1.4.2.0 && < 1.5, fingertree >= 0.1 && < 0.2, ghc-prim,- hashable >= 1.2.1 && < 1.4,+ hashable >= 1.2.4 && < 1.5, indexed-traversable >= 0.1.1 && < 0.2,- lens >= 4.0 && < 6,- mtl >= 2.0.1 && < 2.3,+ lens >= 4.14 && < 6,+ mtl >= 2.2.1 && < 2.3, parsers >= 0.12.1 && < 1,- prettyprinter >= 1.2 && < 2,- prettyprinter-ansi-terminal >= 1.1 && < 2,- profunctors >= 4.0 && < 6,- reducers >= 3.10 && < 4,- transformers >= 0.2 && < 0.6,+ prettyprinter >= 1.7 && < 2,+ prettyprinter-ansi-terminal >= 1.1.2 && < 2,+ profunctors >= 5.2 && < 6,+ reducers >= 3.12.1 && < 4,+ transformers >= 0.5 && < 0.6, unordered-containers >= 0.2.1 && < 0.3, utf8-string >= 0.3.6 && < 1.1 default-language: Haskell2010 hs-source-dirs: src- ghc-options: -O2 -Wall -fobject-code-- -- See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#base-4.9.0.0- if impl(ghc >= 8.0)- ghc-options: -Wcompat -Wnoncanonical-monad-instances- if !impl(ghc >= 8.8)- ghc-options: -Wnoncanonical-monadfail-instances- else- build-depends:- fail == 4.9.*,- semigroups >= 0.8.3.1 && < 1+ ghc-options: -O2 -Wall -Wcompat -Wnoncanonical-monad-instances -fobject-code+ if !impl(ghc >= 8.8)+ ghc-options: -Wnoncanonical-monadfail-instances test-suite quickcheck type: exitcode-stdio-1.0