trifecta 1.5.1.3 → 1.5.2
raw patch · 11 files changed
+145/−32 lines, 11 filesdep +profunctorsdep ~basedep ~lensPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: profunctors
Dependency ranges changed: base, lens
API changes (from Hackage documentation)
+ Text.Trifecta.Util.It: instance Profunctor It
- Text.Trifecta.Highlight: class HasHighlightDoc c_axym where docContent = (.) highlightDoc docContent docCss = (.) highlightDoc docCss docTitle = (.) highlightDoc docTitle
+ Text.Trifecta.Highlight: class HasHighlightDoc c_ayQe where docContent = (.) highlightDoc docContent docCss = (.) highlightDoc docCss docTitle = (.) highlightDoc docTitle
- Text.Trifecta.Highlight: class HasHighlightedRope c_ax2x where ropeContent = (.) highlightedRope ropeContent ropeHighlights = (.) highlightedRope ropeHighlights
+ Text.Trifecta.Highlight: class HasHighlightedRope c_ayko where ropeContent = (.) highlightedRope ropeContent ropeHighlights = (.) highlightedRope ropeHighlights
- Text.Trifecta.Highlight: docContent :: HasHighlightDoc c_axym => Lens' c_axym HighlightedRope
+ Text.Trifecta.Highlight: docContent :: HasHighlightDoc c_ayQe => Lens' c_ayQe HighlightedRope
- Text.Trifecta.Highlight: docCss :: HasHighlightDoc c_axym => Lens' c_axym String
+ Text.Trifecta.Highlight: docCss :: HasHighlightDoc c_ayQe => Lens' c_ayQe String
- Text.Trifecta.Highlight: docTitle :: HasHighlightDoc c_axym => Lens' c_axym String
+ Text.Trifecta.Highlight: docTitle :: HasHighlightDoc c_ayQe => Lens' c_ayQe String
- Text.Trifecta.Highlight: highlightDoc :: HasHighlightDoc c_axym => Lens' c_axym HighlightDoc
+ Text.Trifecta.Highlight: highlightDoc :: HasHighlightDoc c_ayQe => Lens' c_ayQe HighlightDoc
- Text.Trifecta.Highlight: highlightedRope :: HasHighlightedRope c_ax2x => Lens' c_ax2x HighlightedRope
+ Text.Trifecta.Highlight: highlightedRope :: HasHighlightedRope c_ayko => Lens' c_ayko HighlightedRope
- Text.Trifecta.Highlight: ropeContent :: HasHighlightedRope c_ax2x => Lens' c_ax2x Rope
+ Text.Trifecta.Highlight: ropeContent :: HasHighlightedRope c_ayko => Lens' c_ayko Rope
- Text.Trifecta.Highlight: ropeHighlights :: HasHighlightedRope c_ax2x => Lens' c_ax2x (IntervalMap Delta Highlight)
+ Text.Trifecta.Highlight: ropeHighlights :: HasHighlightedRope c_ayko => Lens' c_ayko (IntervalMap Delta Highlight)
- Text.Trifecta.Rendering: class HasFixit c_aCAE where fixitReplacement = (.) fixit fixitReplacement fixitSpan = (.) fixit fixitSpan
+ Text.Trifecta.Rendering: class HasFixit c_aGv1 where fixitReplacement = (.) fixit fixitReplacement fixitSpan = (.) fixit fixitSpan
- Text.Trifecta.Rendering: class HasRendering c_aBhe where renderingDelta = (.) rendering renderingDelta renderingLine = (.) rendering renderingLine renderingLineBytes = (.) rendering renderingLineBytes renderingLineLen = (.) rendering renderingLineLen renderingOverlays = (.) rendering renderingOverlays
+ Text.Trifecta.Rendering: class HasRendering c_aCtt where renderingDelta = (.) rendering renderingDelta renderingLine = (.) rendering renderingLine renderingLineBytes = (.) rendering renderingLineBytes renderingLineLen = (.) rendering renderingLineLen renderingOverlays = (.) rendering renderingOverlays
- Text.Trifecta.Rendering: fixit :: HasFixit c_aCAE => Lens' c_aCAE Fixit
+ Text.Trifecta.Rendering: fixit :: HasFixit c_aGv1 => Lens' c_aGv1 Fixit
- Text.Trifecta.Rendering: fixitReplacement :: HasFixit c_aCAE => Lens' c_aCAE ByteString
+ Text.Trifecta.Rendering: fixitReplacement :: HasFixit c_aGv1 => Lens' c_aGv1 ByteString
- Text.Trifecta.Rendering: fixitSpan :: HasFixit c_aCAE => Lens' c_aCAE Span
+ Text.Trifecta.Rendering: fixitSpan :: HasFixit c_aGv1 => Lens' c_aGv1 Span
- Text.Trifecta.Rendering: rendering :: HasRendering c_aBhe => Lens' c_aBhe Rendering
+ Text.Trifecta.Rendering: rendering :: HasRendering c_aCtt => Lens' c_aCtt Rendering
- Text.Trifecta.Rendering: renderingDelta :: HasRendering c_aBhe => Lens' c_aBhe Delta
+ Text.Trifecta.Rendering: renderingDelta :: HasRendering c_aCtt => Lens' c_aCtt Delta
- Text.Trifecta.Rendering: renderingLine :: HasRendering c_aBhe => Lens' c_aBhe (Lines -> Lines)
+ Text.Trifecta.Rendering: renderingLine :: HasRendering c_aCtt => Lens' c_aCtt (Lines -> Lines)
- Text.Trifecta.Rendering: renderingLineBytes :: HasRendering c_aBhe => Lens' c_aBhe Int64
+ Text.Trifecta.Rendering: renderingLineBytes :: HasRendering c_aCtt => Lens' c_aCtt Int64
- Text.Trifecta.Rendering: renderingLineLen :: HasRendering c_aBhe => Lens' c_aBhe Int64
+ Text.Trifecta.Rendering: renderingLineLen :: HasRendering c_aCtt => Lens' c_aCtt Int64
- Text.Trifecta.Rendering: renderingOverlays :: HasRendering c_aBhe => Lens' c_aBhe (Delta -> Lines -> Lines)
+ Text.Trifecta.Rendering: renderingOverlays :: HasRendering c_aCtt => Lens' c_aCtt (Delta -> Lines -> Lines)
- Text.Trifecta.Result: class HasErr c_a19Cx where expected = (.) err expected footnotes = (.) err footnotes reason = (.) err reason
+ Text.Trifecta.Result: class HasErr c_a1dbq where expected = (.) err expected footnotes = (.) err footnotes reason = (.) err reason
- Text.Trifecta.Result: err :: HasErr c_a19Cx => Lens' c_a19Cx Err
+ Text.Trifecta.Result: err :: HasErr c_a1dbq => Lens' c_a1dbq Err
- Text.Trifecta.Result: expected :: HasErr c_a19Cx => Lens' c_a19Cx (Set String)
+ Text.Trifecta.Result: expected :: HasErr c_a1dbq => Lens' c_a1dbq (Set String)
- Text.Trifecta.Result: footnotes :: HasErr c_a19Cx => Lens' c_a19Cx [Doc]
+ Text.Trifecta.Result: footnotes :: HasErr c_a1dbq => Lens' c_a1dbq [Doc]
- Text.Trifecta.Result: reason :: HasErr c_a19Cx => Lens' c_a19Cx (Maybe Doc)
+ Text.Trifecta.Result: reason :: HasErr c_a1dbq => Lens' c_a1dbq (Maybe Doc)
Files
- .travis.yml +83/−14
- README.markdown +1/−1
- src/Text/Trifecta/Delta.hs +6/−2
- src/Text/Trifecta/Highlight.hs +8/−0
- src/Text/Trifecta/Result.hs +1/−1
- src/Text/Trifecta/Util/Array.hs +3/−1
- src/Text/Trifecta/Util/IntervalMap.hs +14/−2
- src/Text/Trifecta/Util/It.hs +17/−4
- tests/QuickCheck.hs +4/−1
- tests/doctests.hs +4/−0
- trifecta.cabal +4/−6
.travis.yml view
@@ -1,27 +1,96 @@-language: haskell+language: c+sudo: false -before_install:- # Uncomment whenever hackage is down.- # - mkdir -p ~/.cabal && cp travis/config ~/.cabal/config- - cabal update+cache:+ directories:+ - $HOME/.cabsnap+ - $HOME/.cabal/packages - # Try installing some of the build-deps with apt-get for speed.- - travis/cabal-apt-install --only-dependencies --force-reinstall $mode+before_cache:+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar +matrix:+ include:+ - env: CABALVER=1.16 GHCVER=7.4.2+ compiler: ": #GHC 7.4.2"+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.16 GHCVER=7.6.3+ compiler: ": #GHC 7.6.3"+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.18 GHCVER=7.8.4+ compiler: ": #GHC 7.8.4"+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.22 GHCVER=7.10.1+ compiler: ": #GHC 7.10.1"+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.22 GHCVER=7.10.2+ compiler: ": #GHC 7.10.2"+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}++before_install:+ - unset CC+ - export HAPPYVER=1.19.5+ - export ALEXVER=3.1.4+ - export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$PATH+ install:- - cabal configure $mode- - cabal build+ - cabal --version+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];+ then+ zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >+ $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;+ fi+ - travis_retry cabal update+ - "sed -i 's/^jobs:.*$/jobs: 2/' $HOME/.cabal/config"+ - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt +# check whether current requested install-plan matches cached package-db snapshot+ - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;+ then+ echo "cabal build-cache HIT";+ rm -rfv .ghc;+ cp -a $HOME/.cabsnap/ghc $HOME/.ghc;+ cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;+ else+ echo "cabal build-cache MISS";+ rm -rf $HOME/.cabsnap;+ mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;+ cabal install --only-dependencies --enable-tests --enable-benchmarks;+ if [ "$GHCVER" = "7.10.1" ]; then cabal install Cabal-1.22.4.0; fi;+ fi++# snapshot package-db on cache miss+ - if [ ! -d $HOME/.cabsnap ];+ then+ echo "snapshotting package-db to build-cache";+ mkdir $HOME/.cabsnap;+ cp -a $HOME/.ghc $HOME/.cabsnap/ghc;+ cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;+ fi++# Here starts the actual work to be performed for the package under test;+# any command which exits with a non-zero exit code causes the build to fail. script:- - $script+ - cabal configure --enable-tests -v2 # -v2 provides useful information for debugging+ - cabal build # this builds all libraries and executables (including tests)+ - cabal test+ - cabal bench || true # expected result: these will crash+ - cabal sdist || true # tests that a source-distribution can be generated +# Check that the resulting source distribution can be built & installed.+# If there are no other `.tar.gz` files in `dist`, this can be even simpler:+# `cabal install --force-reinstalls dist/*-*.tar.gz`+ - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ")+ notifications: irc: channels: - "irc.freenode.org#haskell-lens" skip_join: true template:- - "\x0313trifecta\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"--env:- - mode="--enable-tests" script="cabal test --show-details=always"+ - "\x0313trifecta\x0f/\x0306%{branch}\x0f \x0314%{commit}\x0f %{message} \x0302\x1f%{build_url}\x0f"+# EOF
README.markdown view
@@ -1,7 +1,7 @@ trifecta ======== -[](http://travis-ci.org/ekmett/trifecta)+[](https://hackage.haskell.org/package/trifecta) [](http://travis-ci.org/ekmett/trifecta) This package provides a parser that focuses on nice diagnostics.
src/Text/Trifecta/Delta.hs view
@@ -1,8 +1,10 @@-{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-} ----------------------------------------------------------------------------- -- | -- Module : Text.Trifecta.Delta--- Copyright : (C) 2011-2014 Edward Kmett+-- Copyright : (C) 2011-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -26,7 +28,9 @@ 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)
src/Text/Trifecta/Highlight.hs view
@@ -1,5 +1,10 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}++#ifndef MIN_VERSION_lens+#define MIN_VERSION_lens(x,y,z) 1+#endif ----------------------------------------------------------------------------- -- | -- Module : Text.Trifecta.Highlight@@ -22,6 +27,9 @@ ) where import Control.Lens+#if MIN_VERSION_lens(4,13,0) && __GLASGOW_HASKELL__ >= 710+ hiding (Empty)+#endif import Data.Foldable as F import Data.Int (Int64) import Data.List (sort)
src/Text/Trifecta/Result.hs view
@@ -80,7 +80,7 @@ | isJust mm = report $ withEx $ Pretty.char ',' <+> expecting | otherwise = report expecting where- now = spaceHack $ List.nub $ toList es+ now = spaceHack $ toList es spaceHack [""] = ["space"] spaceHack xs = List.filter (/= "") xs withEx x = fromMaybe (fillSep $ text <$> words "unspecified error") mm <> x
src/Text/Trifecta/Util/Array.hs view
@@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Text.Trifecta.Util.Array--- Copyright : Edward Kmett 2011-2014+-- Copyright : Edward Kmett 2011-2015 -- Johan Tibell 2011 -- License : BSD3 --@@ -53,7 +53,9 @@ ) where import qualified Data.Traversable as Traversable+#if __GLASGOW_HASKELL__ < 710 import Control.Applicative (Applicative)+#endif import Control.DeepSeq import Control.Monad.ST import GHC.Exts (
src/Text/Trifecta/Util/IntervalMap.hs view
@@ -1,6 +1,11 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-}++#ifndef MIN_VERSION_lens+#define MIN_VERSION_lens(x,y,z) 1+#endif ----------------------------------------------------------------------------- -- | -- Module : Text.Trifecta.Util.IntervalMap@@ -47,11 +52,18 @@ , fromList ) where +#if __GLASGOW_HASKELL__ < 710 import Control.Applicative hiding (empty)-import Control.Lens hiding ((<|),(|>))+import Data.Foldable (Foldable(foldMap))+#endif+import Control.Lens+ hiding ((<|),(|>)+#if MIN_VERSION_lens(4,13,0) && __GLASGOW_HASKELL__ >= 710+ ,(:<)+#endif+ ) import qualified Data.FingerTree as FT import Data.FingerTree (FingerTree, Measured(..), ViewL(..), (<|), (><))-import Data.Foldable (Foldable(foldMap)) import Data.Semigroup import Data.Semigroup.Reducer import Data.Semigroup.Union
src/Text/Trifecta/Util/It.hs view
@@ -1,8 +1,9 @@-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-}-{-# LANGUAGE UnboxedTuples #-}+{-# LANGUAGE BangPatterns #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE UnboxedTuples #-}+{-# LANGUAGE MultiParamTypeClasses #-} ----------------------------------------------------------------------------- -- | -- Module : Text.Trifecta.Util.It@@ -26,12 +27,19 @@ , sliceIt ) where +#if __GLASGOW_HASKELL__ < 710 import Control.Applicative+#endif import Control.Comonad import Control.Monad-import Data.Semigroup++#if __GLASGOW_HASKELL__ < 710+import Data.Monoid+#endif+ import Data.ByteString as Strict import Data.ByteString.Lazy as Lazy+import Data.Profunctor import Text.Trifecta.Rope import Text.Trifecta.Delta import Text.Trifecta.Util.Combinators as Util@@ -47,6 +55,11 @@ instance Functor (It r) where fmap f (Pure a) = Pure $ f a fmap f (It a k) = It (f a) $ fmap f . k+ +instance Profunctor It where+ rmap = fmap+ lmap _ (Pure a) = Pure a+ lmap f (It a g) = It a (lmap f . g . f) instance Applicative (It r) where pure = Pure
tests/QuickCheck.hs view
@@ -1,5 +1,5 @@-{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} module Main ( main@@ -10,7 +10,10 @@ #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
tests/doctests.hs view
@@ -1,7 +1,10 @@+{-# LANGUAGE CPP #-} module Main where import Build_doctests (deps)+#if __GLASGOW_HASKELL__ < 710 import Control.Applicative+#endif import Control.Monad import Data.List import System.Directory@@ -13,6 +16,7 @@ "-isrc" : "-idist/build/autogen" : "-optP-include"+ : "-fobject-code" : "-optPdist/build/autogen/cabal_macros.h" : "-hide-all-packages" : map ("-package="++) deps ++ sources
trifecta.cabal view
@@ -1,6 +1,6 @@ name: trifecta category: Text, Parsing, Diagnostics, Pretty Printer, Logging-version: 1.5.1.3+version: 1.5.2 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -45,9 +45,9 @@ ansi-terminal >= 0.6 && < 0.7, array >= 0.3.0.2 && < 0.6, base >= 4.4 && < 5,- blaze-builder >= 0.3.0.1 && < 0.4,+ blaze-builder >= 0.3.0.1 && < 0.5, blaze-html >= 0.5 && < 0.9,- blaze-markup >= 0.5 && < 0.7,+ blaze-markup >= 0.5 && < 0.8, bytestring >= 0.9.1 && < 0.11, charset >= 0.3.5.1 && < 1, comonad >= 4 && < 5,@@ -59,6 +59,7 @@ lens >= 4.0 && < 5, mtl >= 2.0.1 && < 2.3, parsers >= 0.12.1 && < 1,+ profunctors >= 4.0 && < 6, reducers >= 3.10 && < 4, semigroups >= 0.8.3.1 && < 1, transformers >= 0.2 && < 0.5,@@ -81,9 +82,6 @@ directory >= 1.0, doctest >= 0.9.1, filepath-- if impl(ghc<7.6.1)- ghc-options: -Werror test-suite quickcheck type: exitcode-stdio-1.0