Text.Trifecta.Rope

trifecta-1.6: A modern parser combinator library with convenient diagnostics

Copyright | (C) 2011-2015 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | Safe
Language | Haskell2010

Text.Trifecta.Rope

Description

Synopsis

- data Rope = Rope !Delta !(FingerTree Delta Strand)
- rope :: FingerTree Delta Strand -> Rope
- data Strand
  - = Strand !ByteString !Delta
  - | Skipping !Delta
- strand :: ByteString -> Strand
- strands :: Rope -> FingerTree Delta Strand
- grabRest :: Delta -> Rope -> r -> (Delta -> ByteString -> r) -> r
- grabLine :: Delta -> Rope -> r -> (Delta -> ByteString -> r) -> r

# Documentation

data Rope #

Constructors

Rope !Delta !(FingerTree Delta Strand) |

Instances

Show Rope # |
Methods showsPrec :: Int -> Rope -> ShowS # show :: Rope -> String # showList :: [Rope] -> ShowS #
Semigroup Rope # |
Methods (<>) :: Rope -> Rope -> Rope # sconcat :: NonEmpty Rope -> Rope # stimes :: Integral b => b -> Rope -> Rope #
Monoid Rope # |
Methods mempty :: Rope # mappend :: Rope -> Rope -> Rope # mconcat :: [Rope] -> Rope #
HasDelta Rope # |
Methods delta :: Rope -> Delta #
HasBytes Rope # |
Methods bytes :: Rope -> Int64 #
Measured Delta Rope # |
Methods measure :: Rope -> Delta #
Reducer ByteString Rope # |
Methods unit :: ByteString -> Rope # snoc :: Rope -> ByteString -> Rope # cons :: ByteString -> Rope -> Rope #
Reducer Rope Rope # |
Methods unit :: Rope -> Rope # snoc :: Rope -> Rope -> Rope # cons :: Rope -> Rope -> Rope #
Reducer Strand Rope # |
Methods unit :: Strand -> Rope # snoc :: Rope -> Strand -> Rope # cons :: Strand -> Rope -> Rope #
Reducer [Char] Rope # |
Methods unit :: [Char] -> Rope # snoc :: Rope -> [Char] -> Rope # cons :: [Char] -> Rope -> Rope #

rope :: FingerTree Delta Strand -> Rope #

data Strand #

Constructors

Strand !ByteString !Delta |
Skipping !Delta |

Instances

Data Strand # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Strand -> c Strand # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Strand # toConstr :: Strand -> Constr # dataTypeOf :: Strand -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Strand) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Strand) # gmapT :: (forall b. Data b => b -> b) -> Strand -> Strand # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Strand -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Strand -> r # gmapQ :: (forall d. Data d => d -> u) -> Strand -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Strand -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Strand -> m Strand # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Strand -> m Strand # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Strand -> m Strand #
Show Strand # |
Methods showsPrec :: Int -> Strand -> ShowS # show :: Strand -> String # showList :: [Strand] -> ShowS #
Generic Strand # |
Associated Types type Rep Strand :: * -> * # Methods from :: Strand -> Rep Strand x # to :: Rep Strand x -> Strand #
Hashable Strand # |
Methods hashWithSalt :: Int -> Strand -> Int # hash :: Strand -> Int #
HasDelta Strand # |
Methods delta :: Strand -> Delta #
HasBytes Strand # |
Methods bytes :: Strand -> Int64 #
Measured Delta Strand # |
Methods measure :: Strand -> Delta #
Reducer Strand Rope # |
Methods unit :: Strand -> Rope # snoc :: Rope -> Strand -> Rope # cons :: Strand -> Rope -> Rope #
type Rep Strand # |
type Rep Strand = D1 (MetaData "Strand" "Text.Trifecta.Rope" "trifecta-1.6-7UEU7iTwd2XJ9FB6jKSAsq" False) ((:+:) (C1 (MetaCons "Strand" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 ByteString)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Delta)))) (C1 (MetaCons "Skipping" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Delta))))

strand :: ByteString -> Strand #

strands :: Rope -> FingerTree Delta Strand #

grabRest :: Delta -> Rope -> r -> (Delta -> ByteString -> r) -> r #

grab a the contents of a rope from a given location up to a newline

grabLine :: Delta -> Rope -> r -> (Delta -> ByteString -> r) -> r #

grab a the contents of a rope from a given location up to a newline