Text.Trifecta.Util.It

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.Util.It

Description

harder, better, faster, stronger...

Synopsis

- data It r a
  - = Pure a
  - | It a (r -> It r a)
- needIt :: a -> (r -> Maybe a) -> It r a
- wantIt :: a -> (r -> (#Bool, a#)) -> It r a
- simplifyIt :: It r a -> r -> It r a
- runIt :: (a -> o) -> (a -> (r -> It r a) -> o) -> It r a -> o
- fillIt :: r -> (Delta -> ByteString -> r) -> Delta -> It Rope r
- rewindIt :: Delta -> It Rope (Maybe ByteString)
- sliceIt :: Delta -> Delta -> It Rope ByteString

# Documentation

data It r a #

Constructors

Pure a |
It a (r -> It r a) |

Instances

Profunctor It # |
Methods dimap :: (a -> b) -> (c -> d) -> It b c -> It a d # lmap :: (a -> b) -> It b c -> It a c # rmap :: (b -> c) -> It a b -> It a c # (#.) :: Coercible * c b => (b -> c) -> It a b -> It a c # (.#) :: Coercible * b a => It b c -> (a -> b) -> It a c #
Monad (It r) # |
Methods (>>=) :: It r a -> (a -> It r b) -> It r b # (>>) :: It r a -> It r b -> It r b # return :: a -> It r a # fail :: String -> It r a #
Functor (It r) # |
Methods fmap :: (a -> b) -> It r a -> It r b # (<$) :: a -> It r b -> It r a #
Applicative (It r) # |
Methods pure :: a -> It r a # (<*>) :: It r (a -> b) -> It r a -> It r b # (*>) :: It r a -> It r b -> It r b # (<*) :: It r a -> It r b -> It r a #
Comonad (It r) # | It is a cofree comonad
Methods extract :: It r a -> a # duplicate :: It r a -> It r (It r a) # extend :: (It r a -> b) -> It r a -> It r b #
ComonadApply (It r) # |
Methods (<@>) :: It r (a -> b) -> It r a -> It r b # (@>) :: It r a -> It r b -> It r b # (<@) :: It r a -> It r b -> It r a #
Show a => Show (It r a) # |
Methods showsPrec :: Int -> It r a -> ShowS # show :: It r a -> String # showList :: [It r a] -> ShowS #

needIt :: a -> (r -> Maybe a) -> It r a #

wantIt :: a -> (r -> (#Bool, a#)) -> It r a #

simplifyIt :: It r a -> r -> It r a #

runIt :: (a -> o) -> (a -> (r -> It r a) -> o) -> It r a -> o #

fillIt :: r -> (Delta -> ByteString -> r) -> Delta -> It Rope r #

Given a position, go there, and grab the text forward from that point

rewindIt :: Delta -> It Rope (Maybe ByteString) #

Return the text of the line that contains a given position

sliceIt :: Delta -> Delta -> It Rope ByteString #