core-text 0.2.2.4 → 0.2.2.6
raw patch · 3 files changed
+68/−58 lines, 3 filesdep ~bytestringdep ~deepseqdep ~fingertreePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bytestring, deepseq, fingertree, prettyprinter-ansi-terminal, text, text-short
API changes (from Hackage documentation)
Files
- core-text.cabal +59/−52
- lib/Core/Text/Rope.hs +8/−5
- lib/Core/Text/Utilities.hs +1/−1
core-text.cabal view
@@ -1,57 +1,64 @@ cabal-version: 1.12-name: core-text-version: 0.2.2.4-license: BSD3-license-file: LICENSE-copyright: © 2018-2019 Operational Dynamics Consulting Pty Ltd, and Others-maintainer: Andrew Cowie <andrew@operationaldynamics.com>-author: Andrew Cowie <andrew@operationaldynamics.com>-stability: experimental-tested-with: ghc ==8.6.5-homepage: https://github.com/oprdyn/unbeliever#readme-bug-reports: https://github.com/oprdyn/unbeliever/issues-synopsis: A rope type based on a finger tree over UTF-8 fragments-description:- A rope data type for text, built as a finger tree over UTF-8 text- fragments. The package also includes utiltiy functions for breaking and- re-wrapping lines, conveniences for pretty printing and colourizing- terminal output, and a simple mechanism for multi-line Rope literals.- .- The main @Rope@ type and its usage are described at "Core.Text.Rope" in- this package.- .- This is part of a library intended to ease interoperability and assist in- building command-line programs, both tools and longer-running daemons.- A list of features and some background to the library's design is contained- in the- <https://github.com/oprdyn/unbeliever/blob/master/README.markdown README>- on GitHub.-category: System-build-type: Simple +-- This file has been generated from package.yaml by hpack version 0.31.2.+--+-- see: https://github.com/sol/hpack+--+-- hash: 113b0b96cebb913a06d4c3a2344ce4a18fd0e22758bcdef53ce23081b6f5f355++name: core-text+version: 0.2.2.6+synopsis: A rope type based on a finger tree over UTF-8 fragments+description: A rope data type for text, built as a finger tree over UTF-8 text+ fragments. The package also includes utiltiy functions for breaking and+ re-wrapping lines, conveniences for pretty printing and colourizing+ terminal output, and a simple mechanism for multi-line Rope literals.+ .+ The main @Rope@ type and its usage are described at "Core.Text.Rope" in+ this package.+ .+ This is part of a library intended to ease interoperability and assist in+ building command-line programs, both tools and longer-running daemons.+ A list of features and some background to the library's design is contained+ in the+ <https://github.com/oprdyn/unbeliever/blob/master/README.markdown README>+ on GitHub.+category: System+stability: experimental+homepage: https://github.com/oprdyn/unbeliever#readme+bug-reports: https://github.com/oprdyn/unbeliever/issues+author: Andrew Cowie <andrew@operationaldynamics.com>+maintainer: Andrew Cowie <andrew@operationaldynamics.com>+copyright: © 2018-2019 Operational Dynamics Consulting Pty Ltd, and Others+license: BSD3+license-file: LICENSE+tested-with: GHC == 8.6.5+build-type: Simple+ source-repository head- type: git- location: https://github.com/oprdyn/unbeliever+ type: git+ location: https://github.com/oprdyn/unbeliever library- exposed-modules:- Core.Text- Core.Text.Bytes- Core.Text.Rope- Core.Text.Utilities- hs-source-dirs: lib- other-modules:- Core.Text.Breaking- default-language: Haskell2010- ghc-options: -Wall -Wwarn -fwarn-tabs- build-depends:- base >=4.11 && <5,- bytestring >=0.10.8.2 && <0.11,- deepseq >=1.4.4.0 && <1.5,- fingertree >=0.1.4.2 && <0.2,- hashable >=1.2 && <1.4,- prettyprinter >=1.2.1.1 && <1.6,- prettyprinter-ansi-terminal >=1.1.1.2 && <1.2,- template-haskell >=2.14 && <3,- text >=1.2.3.1 && <1.3,- text-short >=0.1.3 && <0.2+ exposed-modules:+ Core.Text+ Core.Text.Bytes+ Core.Text.Rope+ Core.Text.Utilities+ other-modules:+ Core.Text.Breaking+ hs-source-dirs:+ lib+ ghc-options: -Wall -Wwarn -fwarn-tabs+ build-depends:+ base >=4.11 && <5+ , bytestring+ , deepseq+ , fingertree+ , hashable >=1.2 && <1.4+ , prettyprinter >=1.2.1.1 && <1.6+ , prettyprinter-ansi-terminal+ , template-haskell >=2.14 && <3+ , text+ , text-short+ default-language: Haskell2010
lib/Core/Text/Rope.hs view
@@ -99,7 +99,7 @@ import qualified Data.FingerTree as F (FingerTree, Measured(..), empty , singleton, (><), (<|), (|>), search, SearchResult(..), null , viewl, ViewL(..))-import Data.Foldable (foldr, foldr', foldMap, toList, any)+import Data.Foldable (foldr, foldr', foldl', foldMap, toList, any) import Data.Hashable (Hashable, hashWithSalt) import Data.String (IsString(..)) import qualified Data.Text as T (Text)@@ -319,13 +319,16 @@ -- -- FingerTree Width (Hashed S.ShortText) ----- at the cost of endless unwrapping.+-- at the cost of endless unwrapping. Another alternative would be to cache+-- hash values in the monoid, changing Width from being a wrapper of Int to+-- a record type with width, hash, and perhaps newlines within the+-- corresponding tree. -- instance Hashable Rope where- hashWithSalt salt (Rope x) = foldr f salt x+ hashWithSalt salt (Rope x) = foldl' f salt x where- f :: S.ShortText -> Int -> Int- f piece num = hashWithSalt num piece+ f :: Int -> S.ShortText -> Int+ f num piece = hashWithSalt num piece {-| Machinery to interpret a type as containing valid Unicode that can be
lib/Core/Text/Utilities.hs view
@@ -108,7 +108,7 @@ instance (Render a) => Render [a] where type Token [a] = Token a- colourize = const mempty+ colourize = colourize @a intoDocA = mconcat . fmap intoDocA instance Render T.Text where