-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | The Haskell-Scriptable Editor
--   
--   Yi is a text editor written in Haskell and extensible in Haskell. The
--   goal of the Yi project is to provide a flexible, powerful, and correct
--   editor for haskell hacking.
@package yi
@version 0.7.0

module Yi.Char.Unicode
greek :: [(String, String)]
symbols :: [(String, String)]
subscripts :: [(String, String)]
superscripts :: [(String, String)]
checkAmbs :: [(String, String)] -> [(String, String)]
disamb :: [(String, String)] -> [(String, String)]


-- | This is a little helper for completion interfaces.
module Yi.Keymap.Completion
data CompletionTree a
CT :: [(a, CompletionTree a)] -> CompletionTree a
stepTree :: Eq a => CompletionTree a -> a -> Maybe ([a], CompletionTree a)
obvious :: CompletionTree a -> ([a], CompletionTree a)
mergeTrees :: Ord a => [CompletionTree a] -> CompletionTree a
listToTree :: [a] -> CompletionTree a
complete :: Eq a => CompletionTree a -> [a] -> ([a], CompletionTree a)
instance Show a => Show (CompletionTree a)

module Yi.Debug

-- | Set the file to which debugging output should be written. Though this
--   is called <i>init</i>Debug. Debugging output is not created by default
--   (i.e., if this function is never called.) The target file can not be
--   changed, nor debugging disabled.
initDebug :: FilePath -> IO ()

-- | Outputs the given string before returning the second argument.
trace :: String -> a -> a

-- | Traces <tt>x</tt> and returns <tt>y</tt>.
traceM :: Monad m => String -> a -> m a

-- | Like traceM, but returns ().
traceM_ :: Monad m => String -> m ()
logPutStrLn :: MonadIO m => String -> m ()
logError :: MonadIO m => String -> m ()
logStream :: Show a => String -> Chan a -> IO ()
error :: String -> a

module Yi.Config.Misc
data ScrollStyle
SnapToCenter :: ScrollStyle
SingleLine :: ScrollStyle


-- | String manipulation utilities
module Yi.String
isBlank :: String -> Bool

-- | Remove any trailing strings matching <i>irs</i> (input record
--   separator) from input string. Like perl's chomp(1).
chomp :: String -> String -> String
capitalize :: String -> String
capitalizeFirst :: String -> String

-- | Trim spaces at beginning <i>and</i> end
dropSpace :: String -> String
fillText :: Int -> String -> [String]
onLines :: ([String] -> [String]) -> String -> String

-- | A helper function for creating functions suitable for
--   <tt>modifySelectionB</tt> and <tt>modifyRegionB</tt>. To be used when
--   the desired function should map across the lines of a region.
mapLines :: (String -> String) -> String -> String

-- | Split a String in lines. Unlike <a>lines</a>, this does not remove any
--   empty line at the end.
lines' :: String -> [String]

-- | Inverse of <a>lines'</a>. In contrast to <a>unlines</a>, this does not
--   add an empty line at the end.
unlines' :: [String] -> String
padLeft :: Int -> String -> String
padRight :: Int -> String -> String

module Yi.Paths

-- | Get path to environment file that defines namespace used by Yi command
--   evaluator.
getEvaluatorContextFilename :: MonadIO m => m FilePath

-- | Get Yi master configuration script.
getConfigFilename :: MonadIO m => m FilePath
getConfigModules :: MonadIO m => m FilePath

-- | Get articles.db database of locations to visit (for Yi.IReader.)
getArticleDbFilename :: MonadIO m => m FilePath

-- | Get path to Yi history that stores state between runs.
getPersistentStateFilename :: MonadIO m => m FilePath
getConfigDir :: MonadIO m => m FilePath

-- | Given a path relative to application configuration directory, this
--   function finds a path to a given configuration file.
getConfigPath :: MonadIO m => FilePath -> m FilePath

-- | Given a path relative to application data directory, this function
--   finds a path to a given data file.
getDataPath :: MonadIO m => FilePath -> m FilePath

module Yi.Monad
class Ref ref
readRef :: (Ref ref, MonadIO m) => ref a -> m a
writeRef :: (Ref ref, MonadIO m) => ref a -> a -> m ()
modifyRef :: (Ref ref, MonadIO m) => ref a -> (a -> a) -> m ()

-- | Gets specific component of the state, using a projection function
--   supplied.
gets :: MonadState s m => (s -> a) -> m a
getsA :: MonadState s m => Accessor s p -> (p -> a) -> m a

-- | Combination of the Control.Monad.State <a>modify</a> and <a>gets</a>
getsAndModify :: MonadState s m => (s -> (s, a)) -> m a
maybeM :: Monad m => (x -> m ()) -> Maybe x -> m ()
modifiesRef :: (Ref ref, MonadReader r m, MonadIO m) => (r -> ref a) -> (a -> a) -> m ()
modifiesThenReadsRef :: (MonadReader r m, MonadIO m) => (r -> IORef a) -> (a -> a) -> m a
readsRef :: (Ref ref, MonadReader r m, MonadIO m) => (r -> ref a) -> m a

-- | Rerun the monad until the boolean result is false, collecting list of
--   results.
repeatUntilM :: Monad m => m (Bool, a) -> m [a]
whenM :: Monad m => m Bool -> m () -> m ()
with :: (MonadReader yi m, MonadIO m) => (yi -> component) -> (component -> IO a) -> m a
writesRef :: (MonadReader r m, MonadIO m) => (r -> IORef a) -> a -> m ()
instance Ref MVar
instance Ref IORef

module Yi.Prelude
(<>) :: Monoid a => a -> a -> a

-- | Append two lists, i.e.,
--   
--   <pre>
--   [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
--   [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
--   </pre>
--   
--   If the first list is not finite, the result is the first list.
(++) :: [a] -> [a] -> [a]

-- | Same as <a>&gt;&gt;=</a>, but with the arguments interchanged.
(=<<) :: Monad m => (a -> m b) -> m a -> m b

-- | Right-to-left Kleisli composition of monads.
--   <tt>(<a>&gt;=&gt;</a>)</tt>, with the arguments flipped
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c

-- | Strict (call-by-value) application, defined in terms of <a>seq</a>.
($!) :: (a -> b) -> a -> b

-- | Double-precision floating point numbers. It is desirable that this
--   type be at least equal in range and precision to the IEEE
--   double-precision type.
data Double :: *

-- | The <tt>Binary</tt> class provides <a>put</a> and <a>get</a>, methods
--   to encode and decode a Haskell value to a lazy ByteString. It mirrors
--   the Read and Show classes for textual representation of Haskell types,
--   and is suitable for serialising Haskell values to disk, over the
--   network.
--   
--   For parsing and generating simple external binary formats (e.g. C
--   structures), Binary may be used, but in general is not suitable for
--   complex protocols. Instead use the Put and Get primitives directly.
--   
--   Instances of Binary should satisfy the following property:
--   
--   <pre>
--   decode . encode == id
--   </pre>
--   
--   That is, the <a>get</a> and <a>put</a> methods should be the inverse
--   of each other. A range of instances are provided for basic Haskell
--   types.
class Binary t

-- | The character type <a>Char</a> is an enumeration whose values
--   represent Unicode (or equivalently ISO/IEC 10646) characters (see
--   <a>http://www.unicode.org/</a> for details). This set extends the ISO
--   8859-1 (Latin-1) character set (the first 256 characters), which is
--   itself an extension of the ASCII character set (the first 128
--   characters). A character literal in Haskell has type <a>Char</a>.
--   
--   To convert a <a>Char</a> to or from the corresponding <a>Int</a> value
--   defined by Unicode, use <a>toEnum</a> and <a>fromEnum</a> from the
--   <a>Enum</a> class respectively (or equivalently <tt>ord</tt> and
--   <tt>chr</tt>).
data Char :: *

-- | The <a>Either</a> type represents values with two possibilities: a
--   value of type <tt><a>Either</a> a b</tt> is either <tt><a>Left</a>
--   a</tt> or <tt><a>Right</a> b</tt>.
--   
--   The <a>Either</a> type is sometimes used to represent a value which is
--   either correct or an error; by convention, the <a>Left</a> constructor
--   is used to hold an error value and the <a>Right</a> constructor is
--   used to hold a correct value (mnemonic: "right" also means "correct").
data Either a b :: * -> * -> *
Left :: a -> Either a b
Right :: b -> Either a b
type Endom a = a -> a

-- | The <a>Eq</a> class defines equality (<a>==</a>) and inequality
--   (<a>/=</a>). All the basic datatypes exported by the <a>Prelude</a>
--   are instances of <a>Eq</a>, and <a>Eq</a> may be derived for any
--   datatype whose constituents are also instances of <a>Eq</a>.
--   
--   Minimal complete definition: either <a>==</a> or <a>/=</a>.
class Eq a
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool

-- | Fractional numbers, supporting real division.
--   
--   Minimal complete definition: <a>fromRational</a> and (<a>recip</a> or
--   <tt>(<a>/</a>)</tt>)
class Num a => Fractional a
(/) :: Fractional a => a -> a -> a
recip :: Fractional a => a -> a
fromRational :: Fractional a => Rational -> a

-- | The <a>Functor</a> class is used for types that can be mapped over.
--   Instances of <a>Functor</a> should satisfy the following laws:
--   
--   <pre>
--   fmap id  ==  id
--   fmap (f . g)  ==  fmap f . fmap g
--   </pre>
--   
--   The instances of <a>Functor</a> for lists, <a>Maybe</a> and <a>IO</a>
--   satisfy these laws.
class Functor (f :: * -> *)
fmap :: Functor f => (a -> b) -> f a -> f b

-- | A value of type <tt><a>IO</a> a</tt> is a computation which, when
--   performed, does some I/O before returning a value of type <tt>a</tt>.
--   
--   There is really only one way to "perform" an I/O action: bind it to
--   <tt>Main.main</tt> in your program. When your program is run, the I/O
--   will be performed. It isn't possible to perform I/O from an arbitrary
--   function, unless that function is itself in the <a>IO</a> monad and
--   called at some point, directly or indirectly, from <tt>Main.main</tt>.
--   
--   <a>IO</a> is a monad, so <a>IO</a> actions can be combined using
--   either the do-notation or the <tt>&gt;&gt;</tt> and <tt>&gt;&gt;=</tt>
--   operations from the <tt>Monad</tt> class.
data IO a :: * -> *

-- | The default value. If a function tries to get a copy of the state, but
--   the state hasn't yet been created, <a>initial</a> will be called to
--   supply *some* value. The value of initial will probably be something
--   like Nothing, [], "", or <a>empty</a> - compare the <tt>mempty</tt> of
--   <a>Data.Monoid</a>.
class Initializable a
initial :: Initializable a => a

-- | Arbitrary-precision integers.
data Integer :: *

-- | Integral numbers, supporting integer division.
--   
--   Minimal complete definition: <a>quotRem</a> and <a>toInteger</a>
class (Real a, Enum a) => Integral a
quot :: Integral a => a -> a -> a
rem :: Integral a => a -> a -> a
div :: Integral a => a -> a -> a
mod :: Integral a => a -> a -> a
quotRem :: Integral a => a -> a -> (a, a)
divMod :: Integral a => a -> a -> (a, a)
toInteger :: Integral a => a -> Integer

-- | The <a>Bounded</a> class is used to name the upper and lower limits of
--   a type. <a>Ord</a> is not a superclass of <a>Bounded</a> since types
--   that are not totally ordered may also have upper and lower bounds.
--   
--   The <a>Bounded</a> class may be derived for any enumeration type;
--   <a>minBound</a> is the first constructor listed in the <tt>data</tt>
--   declaration and <a>maxBound</a> is the last. <a>Bounded</a> may also
--   be derived for single-constructor datatypes whose constituent types
--   are in <a>Bounded</a>.
class Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a

-- | Class <a>Enum</a> defines operations on sequentially ordered types.
--   
--   The <tt>enumFrom</tt>... methods are used in Haskell's translation of
--   arithmetic sequences.
--   
--   Instances of <a>Enum</a> may be derived for any enumeration type
--   (types whose constructors have no fields). The nullary constructors
--   are assumed to be numbered left-to-right by <a>fromEnum</a> from
--   <tt>0</tt> through <tt>n-1</tt>. See Chapter 10 of the <i>Haskell
--   Report</i> for more details.
--   
--   For any type that is an instance of class <a>Bounded</a> as well as
--   <a>Enum</a>, the following should hold:
--   
--   <ul>
--   <li>The calls <tt><a>succ</a> <a>maxBound</a></tt> and <tt><a>pred</a>
--   <a>minBound</a></tt> should result in a runtime error.</li>
--   <li><a>fromEnum</a> and <a>toEnum</a> should give a runtime error if
--   the result value is not representable in the result type. For example,
--   <tt><a>toEnum</a> 7 :: <a>Bool</a></tt> is an error.</li>
--   <li><a>enumFrom</a> and <a>enumFromThen</a> should be defined with an
--   implicit bound, thus:</li>
--   </ul>
--   
--   <pre>
--   enumFrom     x   = enumFromTo     x maxBound
--   enumFromThen x y = enumFromThenTo x y bound
--     where
--       bound | fromEnum y &gt;= fromEnum x = maxBound
--             | otherwise                = minBound
--   </pre>
class Enum a
succ :: Enum a => a -> a
pred :: Enum a => a -> a
toEnum :: Enum a => Int -> a
fromEnum :: Enum a => a -> Int
enumFrom :: Enum a => a -> [a]
enumFromThen :: Enum a => a -> a -> [a]
enumFromTo :: Enum a => a -> a -> [a]
enumFromThenTo :: Enum a => a -> a -> a -> [a]

-- | The <a>Maybe</a> type encapsulates an optional value. A value of type
--   <tt><a>Maybe</a> a</tt> either contains a value of type <tt>a</tt>
--   (represented as <tt><a>Just</a> a</tt>), or it is empty (represented
--   as <a>Nothing</a>). Using <a>Maybe</a> is a good way to deal with
--   errors or exceptional cases without resorting to drastic measures such
--   as <a>error</a>.
--   
--   The <a>Maybe</a> type is also a monad. It is a simple kind of error
--   monad, where all errors are represented by <a>Nothing</a>. A richer
--   error monad can be built using the <a>Either</a> type.
data Maybe a :: * -> *
Nothing :: Maybe a
Just :: a -> Maybe a

-- | The <a>Monad</a> class defines the basic operations over a
--   <i>monad</i>, a concept from a branch of mathematics known as
--   <i>category theory</i>. From the perspective of a Haskell programmer,
--   however, it is best to think of a monad as an <i>abstract datatype</i>
--   of actions. Haskell's <tt>do</tt> expressions provide a convenient
--   syntax for writing monadic expressions.
--   
--   Minimal complete definition: <a>&gt;&gt;=</a> and <a>return</a>.
--   
--   Instances of <a>Monad</a> should satisfy the following laws:
--   
--   <pre>
--   return a &gt;&gt;= k  ==  k a
--   m &gt;&gt;= return  ==  m
--   m &gt;&gt;= (\x -&gt; k x &gt;&gt;= h)  ==  (m &gt;&gt;= k) &gt;&gt;= h
--   </pre>
--   
--   Instances of both <a>Monad</a> and <a>Functor</a> should additionally
--   satisfy the law:
--   
--   <pre>
--   fmap f xs  ==  xs &gt;&gt;= return . f
--   </pre>
--   
--   The instances of <a>Monad</a> for lists, <a>Maybe</a> and <a>IO</a>
--   defined in the <a>Prelude</a> satisfy these laws.
class Monad (m :: * -> *)
(>>=) :: Monad m => m a -> (a -> m b) -> m b
(>>) :: Monad m => m a -> m b -> m b
return :: Monad m => a -> m a
fail :: Monad m => String -> m a

-- | Basic numeric class.
--   
--   Minimal complete definition: all except <a>negate</a> or <tt>(-)</tt>
class Num a
(+) :: Num a => a -> a -> a
(*) :: Num a => a -> a -> a
(-) :: Num a => a -> a -> a
negate :: Num a => a -> a
abs :: Num a => a -> a
signum :: Num a => a -> a
fromInteger :: Num a => Integer -> a

-- | The <a>Ord</a> class is used for totally ordered datatypes.
--   
--   Instances of <a>Ord</a> can be derived for any user-defined datatype
--   whose constituent types are in <a>Ord</a>. The declared order of the
--   constructors in the data declaration determines the ordering in
--   derived <a>Ord</a> instances. The <a>Ordering</a> datatype allows a
--   single comparison to determine the precise ordering of two objects.
--   
--   Minimal complete definition: either <a>compare</a> or <a>&lt;=</a>.
--   Using <a>compare</a> can be more efficient for complex types.
class Eq a => Ord a
compare :: Ord a => a -> a -> Ordering
(<) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(<=) :: Ord a => a -> a -> Bool
max :: Ord a => a -> a -> a
min :: Ord a => a -> a -> a

-- | Parsing of <a>String</a>s, producing values.
--   
--   Minimal complete definition: <a>readsPrec</a> (or, for GHC only,
--   <a>readPrec</a>)
--   
--   Derived instances of <a>Read</a> make the following assumptions, which
--   derived instances of <a>Show</a> obey:
--   
--   <ul>
--   <li>If the constructor is defined to be an infix operator, then the
--   derived <a>Read</a> instance will parse only infix applications of the
--   constructor (not the prefix form).</li>
--   <li>Associativity is not used to reduce the occurrence of parentheses,
--   although precedence may be.</li>
--   <li>If the constructor is defined using record syntax, the derived
--   <a>Read</a> will parse only the record-syntax form, and furthermore,
--   the fields must be given in the same order as the original
--   declaration.</li>
--   <li>The derived <a>Read</a> instance allows arbitrary Haskell
--   whitespace between tokens of the input string. Extra parentheses are
--   also allowed.</li>
--   </ul>
--   
--   For example, given the declarations
--   
--   <pre>
--   infixr 5 :^:
--   data Tree a =  Leaf a  |  Tree a :^: Tree a
--   </pre>
--   
--   the derived instance of <a>Read</a> in Haskell 98 is equivalent to
--   
--   <pre>
--   instance (Read a) =&gt; Read (Tree a) where
--   
--           readsPrec d r =  readParen (d &gt; app_prec)
--                            (\r -&gt; [(Leaf m,t) |
--                                    ("Leaf",s) &lt;- lex r,
--                                    (m,t) &lt;- readsPrec (app_prec+1) s]) r
--   
--                         ++ readParen (d &gt; up_prec)
--                            (\r -&gt; [(u:^:v,w) |
--                                    (u,s) &lt;- readsPrec (up_prec+1) r,
--                                    (":^:",t) &lt;- lex s,
--                                    (v,w) &lt;- readsPrec (up_prec+1) t]) r
--   
--             where app_prec = 10
--                   up_prec = 5
--   </pre>
--   
--   Note that right-associativity of <tt>:^:</tt> is unused.
--   
--   The derived instance in GHC is equivalent to
--   
--   <pre>
--   instance (Read a) =&gt; Read (Tree a) where
--   
--           readPrec = parens $ (prec app_prec $ do
--                                    Ident "Leaf" &lt;- lexP
--                                    m &lt;- step readPrec
--                                    return (Leaf m))
--   
--                        +++ (prec up_prec $ do
--                                    u &lt;- step readPrec
--                                    Symbol ":^:" &lt;- lexP
--                                    v &lt;- step readPrec
--                                    return (u :^: v))
--   
--             where app_prec = 10
--                   up_prec = 5
--   
--           readListPrec = readListPrecDefault
--   </pre>
class Read a
readsPrec :: Read a => Int -> ReadS a
readList :: Read a => ReadS [a]
class (Num a, Ord a) => Real a
toRational :: Real a => a -> Rational

-- | Extracting components of fractions.
--   
--   Minimal complete definition: <a>properFraction</a>
class (Real a, Fractional a) => RealFrac a
properFraction :: (RealFrac a, Integral b) => a -> (b, a)
truncate :: (RealFrac a, Integral b) => a -> b
round :: (RealFrac a, Integral b) => a -> b
ceiling :: (RealFrac a, Integral b) => a -> b
floor :: (RealFrac a, Integral b) => a -> b
newtype ReaderT r (m :: * -> *) a :: * -> (* -> *) -> * -> *
ReaderT :: (r -> m a) -> ReaderT r a
runReaderT :: ReaderT r a -> r -> m a
class SemiNum absolute relative | absolute -> relative
(+~) :: SemiNum absolute relative => absolute -> relative -> absolute
(-~) :: SemiNum absolute relative => absolute -> relative -> absolute
(~-) :: SemiNum absolute relative => absolute -> absolute -> relative

-- | A <a>String</a> is a list of characters. String constants in Haskell
--   are values of type <a>String</a>.
type String = [Char]

-- | The class <a>Typeable</a> allows a concrete representation of a type
--   to be calculated.
class Typeable a

-- | Return the longest common prefix of a set of lists.
--   
--   <pre>
--   P(xs) === all (isPrefixOf (commonPrefix xs)) xs
--   length s &gt; length (commonPrefix xs) --&gt; not (all (isPrefixOf s) xs)
--   </pre>
commonPrefix :: Eq a => [[a]] -> [a]
discard :: Functor f => f a -> f ()

-- | Write nothing. Use with <a>dummyGet</a>
dummyPut :: a -> Put

-- | Read nothing, and return <a>initial</a>. Use with <a>dummyPut</a>.
dummyGet :: Initializable a => Get a

-- | Lift an accessor to a traversable structure. (This can be seen as a
--   generalization of fmap)
every :: Traversable t => Accessor whole part -> Accessor (t whole) (t part)

-- | Finds the first element satisfying the predicate, and returns a zipper
--   pointing at it.
findPL :: (a -> Bool) -> [a] -> Maybe (PointedList a)
focusA :: Accessor (PointedList a) a

-- | general coercion from integral types
fromIntegral :: (Integral a, Num b) => a -> b

-- | Extract the first component of a pair.
fst :: (a, b) -> a
fst3 :: (a, b, c) -> a

-- | Alternative to groupBy.
--   
--   <pre>
--   groupBy' (\a b -&gt; abs (a - b) &lt;= 1) [1,2,3] = [[1,2,3]]
--   </pre>
--   
--   whereas
--   
--   <pre>
--   groupBy (\a b -&gt; abs (a - b) &lt;= 1) [1,2,3] = [[1,2],[3]]
--   </pre>
--   
--   TODO: Check in ghc 6.12 release if groupBy == groupBy'.
groupBy' :: (a -> a -> Bool) -> [a] -> [[a]]
list :: b -> (a -> [a] -> b) -> [a] -> b

-- | Extract the first element of a list, which must be non-empty.
head :: [a] -> a

-- | Return all the elements of a list except the last one. The list must
--   be non-empty.
init :: [a] -> [a]
io :: MonadIO m => IO a -> m a

-- | Extract the last element of a list, which must be finite and
--   non-empty.
last :: [a] -> a

-- | <a>lookup</a> <tt>key assocs</tt> looks up a key in an association
--   list.
lookup :: Eq a => a -> [(a, b)] -> Maybe b

-- | As Map.adjust, but the combining function is applied strictly.
mapAdjust' :: Ord k => (a -> a) -> k -> Map k a -> Map k a

-- | As Map.alter, but the newly inserted element is forced with the map.
mapAlter' :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a

-- | Generalisation of <a>fromList</a> to arbitrary foldables.
mapFromFoldable :: (Foldable t, Ord k) => t (k, a) -> Map k a
putA :: MonadState r m => T r a -> a -> m ()
getA :: MonadState r m => T r a -> m a
modA :: MonadState r m => T r a -> (a -> a) -> m ()
data Rope
fromString :: String -> Rope
toString :: Rope -> String
toReverseString :: Rope -> String
null :: Rope -> Bool
empty :: Rope
take :: Int -> Rope -> Rope
drop :: Int -> Rope -> Rope

-- | Get the length of the string. (This information cached, so O(1)
--   amortized runtime.)
length :: Rope -> Int
reverse :: Rope -> Rope

-- | Count the number of newlines in the strings. (This information cached,
--   so O(1) amortized runtime.)
countNewLines :: Rope -> Int
split :: Word8 -> Rope -> [Rope]

-- | Split the string at the specified position.
splitAt :: Int -> Rope -> (Rope, Rope)

-- | Split before the specified line. Lines are indexed from 0.
splitAtLine :: Int -> Rope -> (Rope, Rope)

-- | Append two strings by merging the two finger trees.
append :: Rope -> Rope -> Rope
concat :: [Rope] -> Rope
readFile :: FilePath -> IO Rope
writeFile :: FilePath -> Rope -> IO ()

-- | Split the rope on a chunk, so that the desired position lies within
--   the first chunk of the second rope.
splitAtChunkBefore :: Int -> Rope -> (Rope, Rope)

-- | As <a>nub</a>, but with O(n*log(n)) behaviour.
nubSet :: Ord a => [a] -> [a]

-- | Test whether a list is empty.
null :: [a] -> Bool

-- | The <a>print</a> function outputs a value of any printable type to the
--   standard output device. Printable types are those that are instances
--   of class <a>Show</a>; <a>print</a> converts values to strings for
--   output using the <a>show</a> operation and adds a newline.
--   
--   For example, a program to print the first 20 integers and their powers
--   of 2 could be written as:
--   
--   <pre>
--   main = print ([(n, 2^n) | n &lt;- [0..19]])
--   </pre>
print :: Show a => a -> IO ()

-- | The same as <a>putStr</a>, but adds a newline character.
putStrLn :: String -> IO ()

-- | <a>replicate</a> <tt>n x</tt> is a list of length <tt>n</tt> with
--   <tt>x</tt> the value of every element. It is an instance of the more
--   general <a>genericReplicate</a>, in which <tt>n</tt> may be of any
--   integral type.
replicate :: Int -> a -> [a]

-- | The <a>read</a> function reads input from a string, which must be
--   completely consumed by the input process.
read :: Read a => String -> a

-- | Evaluates its first argument to head normal form, and then returns its
--   second argument as the result.
seq :: a -> b -> b
singleton :: a -> [a]

-- | Extract the second component of a pair.
snd :: (a, b) -> b
snd3 :: (a, b, c) -> b

-- | Given a function which moves the focus from index A to index B, return
--   a function which swaps the elements at indexes A and B and then moves
--   the focus. See Yi.Editor.swapWinWithFirstE for an example.
swapFocus :: (PointedList a -> PointedList a) -> (PointedList a -> PointedList a)

-- | Extract the elements after the head of a list, which must be
--   non-empty.
tail :: [a] -> [a]
trd3 :: (a, b, c) -> c

-- | A special case of <a>error</a>. It is expected that compilers will
--   recognize this and insert error messages which are more appropriate to
--   the context in which <a>undefined</a> appears.
undefined :: a

-- | <a>unlines</a> is an inverse operation to <a>lines</a>. It joins
--   lines, after appending a terminating newline to each.
unlines :: [String] -> String

-- | Conditional execution of monadic expressions. For example,
--   
--   <pre>
--   when debug (putStr "Debugging\n")
--   </pre>
--   
--   will output the string <tt>Debugging\n</tt> if the Boolean value
--   <tt>debug</tt> is <a>True</a>, and otherwise do nothing.
when :: Monad m => Bool -> m () -> m ()

-- | The computation <a>writeFile</a> <tt>file str</tt> function writes the
--   string <tt>str</tt>, to the file <tt>file</tt>.
writeFile :: FilePath -> String -> IO ()
instance (Eq k, Hashable k, Binary k, Binary v) => Binary (HashMap k v)
instance Initializable (Maybe a)

module Yi.Event
data Event
Event :: Key -> [Modifier] -> Event
prettyEvent :: Event -> String
data Key
KEsc :: Key
KFun :: Int -> Key
KPrtScr :: Key
KPause :: Key
KASCII :: Char -> Key
KBS :: Key
KIns :: Key
KHome :: Key
KPageUp :: Key
KDel :: Key
KEnd :: Key
KPageDown :: Key
KNP5 :: Key
KUp :: Key
KMenu :: Key
KLeft :: Key
KDown :: Key
KRight :: Key
KEnter :: Key
KTab :: Key
data Modifier
MShift :: Modifier
MCtrl :: Modifier
MMeta :: Modifier
MSuper :: Modifier
MHyper :: Modifier

-- | Map an Event to a Char. This is used in the emacs keymap for Ctrl-Q
--   and vim keymap <tt>insertSpecialChar</tt>
eventToChar :: Event -> Char
instance Show Modifier
instance Eq Modifier
instance Ord Modifier
instance Eq Key
instance Show Key
instance Ord Key
instance Eq Event
instance Show Event
instance Ord Event


-- | This module defines the layout manager interface (see
--   <a>LayoutManager</a>). To desgin a new layout manager, just make an
--   instance of this class.
module Yi.Layout

-- | UI-agnostic layout schema. The basic constructs are
--   (horizontal/vertical) stacks with fixed ratios between window sizes;
--   and (horizontal/vertical) pairs with a slider in between (if
--   available).
data Layout a
SingleWindow :: a -> Layout a
Stack :: !Orientation -> [(Layout a, RelativeSize)] -> Layout a

-- | Orientation
--   
--   Orientation
orientation :: Layout a -> !Orientation

-- | The layout stack, with the given weights TODO: fix strictness for
--   stack (it's still lazy)
wins :: Layout a -> [(Layout a, RelativeSize)]
Pair :: !Orientation -> !DividerPosition -> !DividerRef -> !(Layout a) -> !(Layout a) -> Layout a

-- | Orientation
--   
--   Orientation
orientation :: Layout a -> !Orientation

-- | Initial position of the divider
divPos :: Layout a -> !DividerPosition

-- | Index of the divider (for updating the divider position)
divRef :: Layout a -> !DividerRef

-- | Upper of of the pair
pairFst :: Layout a -> !(Layout a)

-- | Lower of the pair
pairSnd :: Layout a -> !(Layout a)

-- | Orientations for <a>Stack</a> and <a>Pair</a>
data Orientation
Horizontal :: Orientation
Vertical :: Orientation

-- | Divider position, in the range (0,1)
type DividerPosition = Double

-- | Divider reference
type DividerRef = Int

-- | Relative sizes, for <a>Stack</a>
type RelativeSize = Double

-- | Accessor for the <a>DividerPosition</a> with given reference
dividerPositionA :: DividerRef -> Accessor (Layout a) DividerPosition

-- | The type of layout managers. See the layout managers <a>tall</a>,
--   <a>hPairNStack</a> and <a>slidyTall</a> for some example
--   implementations.
class (Typeable m, Eq m) => LayoutManager m where nextVariant = id previousVariant = id
pureLayout :: LayoutManager m => m -> Layout a -> [a] -> Layout a
describeLayout :: LayoutManager m => m -> String
nextVariant :: LayoutManager m => m -> m
previousVariant :: LayoutManager m => m -> m

-- | Existential wrapper for <a>Layout</a>
data AnyLayoutManager
AnyLayoutManager :: !m -> AnyLayoutManager

-- | True if the internal layout managers have the same type (but are not
--   necessarily equal).
layoutManagerSameType :: AnyLayoutManager -> AnyLayoutManager -> Bool

-- | Windows placed on top of one another, equally spaced
wide :: AnyLayoutManager

-- | Windows placed side-by-side, equally spaced.
tall :: AnyLayoutManager

-- | Tall windows, arranged in a balanced binary tree with sliders in
--   between them.
slidyTall :: AnyLayoutManager

-- | Transposed version of <a>slidyTall</a>
slidyWide :: AnyLayoutManager

-- | <tt>n</tt> windows on the left; stack of windows on the right.
hPairNStack :: Int -> AnyLayoutManager

-- | Transposed version of <a>hPairNStack</a>.
vPairNStack :: Int -> AnyLayoutManager

-- | A general bounding box
data Rectangle
Rectangle :: !Double -> !Double -> !Double -> !Double -> Rectangle
rectX :: Rectangle -> !Double
rectY :: Rectangle -> !Double
rectWidth :: Rectangle -> !Double
rectHeight :: Rectangle -> !Double
layoutToRectangles :: Rectangle -> Layout a -> [(a, Rectangle)]

-- | Things with orientations which can be flipped
class Transposable r
transpose :: Transposable r => r -> r

-- | Same as <tt>lm</tt>, but with all <a>Orientation</a>s
--   <a>transpose</a>d. See <a>slidyWide</a> for an example of its use.
newtype Transposed lm
Transposed :: lm -> Transposed lm

-- | A 'Layout a' wrapped in a state monad for tracking <a>DividerRef</a>s.
--   This type is <i>not</i> itself a monad, but should rather be thought
--   of as a <a>DividerRef</a>-free version of the <a>Layout</a> type.
data LayoutM a
pair :: Orientation -> DividerPosition -> LayoutM a -> LayoutM a -> LayoutM a
singleWindow :: a -> LayoutM a
stack :: Orientation -> [(LayoutM a, RelativeSize)] -> LayoutM a

-- | Special case of <a>stack</a> with all <a>RelativeSize</a>s equal.
evenStack :: Orientation -> [LayoutM a] -> LayoutM a
runLayoutM :: LayoutM a -> Layout a
instance Typeable1 Layout
instance Typeable AnyLayoutManager
instance Typeable Tall
instance Typeable Wide
instance Typeable SlidyTall
instance Typeable HPairNStack
instance Typeable1 Transposed
instance Typeable VPairNStack
instance Typeable SlidyWide
instance Eq Orientation
instance Show Orientation
instance Eq a => Eq (Layout a)
instance Functor Layout
instance Eq Tall
instance Eq Wide
instance Eq SlidyTall
instance Eq HPairNStack
instance Eq Rectangle
instance Show Rectangle
instance Eq lm => Eq (Transposed lm)
instance Eq VPairNStack
instance Eq SlidyWide
instance LayoutManager lm => LayoutManager (Transposed lm)
instance Transposable (Layout a)
instance Transposable Orientation
instance LayoutManager VPairNStack
instance LayoutManager HPairNStack
instance LayoutManager SlidyWide
instance LayoutManager SlidyTall
instance LayoutManager Wide
instance LayoutManager Tall
instance Initializable AnyLayoutManager
instance LayoutManager AnyLayoutManager
instance Eq AnyLayoutManager
instance Initializable a => Initializable (Layout a)
instance Show a => Show (Layout a)


-- | Colors and friends.
module Yi.Style

-- | Visual text attributes to be applied during layout.
data Attributes
Attributes :: !Color -> !Color -> !Bool -> !Bool -> !Bool -> !Bool -> Attributes
foreground :: Attributes -> !Color
background :: Attributes -> !Color

-- | The text should be show as <a>active</a> or <a>selected</a>. This can
--   be implemented by reverse video on the terminal.
reverseAttr :: Attributes -> !Bool
bold :: Attributes -> !Bool
italic :: Attributes -> !Bool
underline :: Attributes -> !Bool
emptyAttributes :: Attributes

-- | The style is used to transform attributes by modifying one or more of
--   the visual text attributes.
type Style = Endo Attributes

-- | The UI type
data UIStyle
UIStyle :: Attributes -> Style -> Attributes -> Style -> Style -> Attributes -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> Style -> UIStyle

-- | ground attributes for the modeline
modelineAttributes :: UIStyle -> Attributes

-- | transformation of modeline in focus
modelineFocusStyle :: UIStyle -> Style

-- | ground attributes for the tabbar
tabBarAttributes :: UIStyle -> Attributes

-- | a tab that currently holds the focus
tabInFocusStyle :: UIStyle -> Style

-- | a tab that does not have the current focus
tabNotFocusedStyle :: UIStyle -> Style

-- | ground attributes for the main text views
baseAttributes :: UIStyle -> Attributes

-- | the selected portion
selectedStyle :: UIStyle -> Style

-- | empty file marker colours
eofStyle :: UIStyle -> Style

-- | indicates errors in text
errorStyle :: UIStyle -> Style

-- | search matches<i>paren matches</i>other hints
hintStyle :: UIStyle -> Style

-- | current search match
strongHintStyle :: UIStyle -> Style

-- | all comments
commentStyle :: UIStyle -> Style

-- | additional only for block comments
blockCommentStyle :: UIStyle -> Style

-- | applied to language keywords
keywordStyle :: UIStyle -> Style

-- | numbers
numberStyle :: UIStyle -> Style

-- | preprocessor directive (often in Haskell or C)
preprocessorStyle :: UIStyle -> Style

-- | constant strings
stringStyle :: UIStyle -> Style

-- | additional style for long strings
longStringStyle :: UIStyle -> Style

-- | type name (such as class in an OO language)
typeStyle :: UIStyle -> Style

-- | data constructor
dataConstructorStyle :: UIStyle -> Style

-- | style of import names
importStyle :: UIStyle -> Style

-- | builtin things, e.g. Array in JavaScript
builtinStyle :: UIStyle -> Style

-- | regular expressions
regexStyle :: UIStyle -> Style

-- | any standard variable (identifier)
variableStyle :: UIStyle -> Style

-- | infix operators
operatorStyle :: UIStyle -> Style

-- | Style of a quotation (e.g. in template haskell)
quoteStyle :: UIStyle -> Style

-- | stuff that's passed to the shell in a Makefile
makeFileAction :: UIStyle -> Style

-- | makefile rule headers
makeFileRuleHead :: UIStyle -> Style

-- | A StyleName determines what style to use, taking into account the set
--   of rendering preferences given by a <a>UIStyle</a>. Typically, style
--   names will be <a>Style</a>-valued field names of <a>UIStyle</a>.
type StyleName = UIStyle -> Style

-- | A style that sets the foreground.
withFg :: Color -> Style

-- | A style that sets the background.
withBg :: Color -> Style

-- | A style that sets the font to bold
withBd :: Bool -> Style

-- | A style that sets the style to underlined
withReverse :: Bool -> Style

-- | A style that sets the style to underlined
withUnderline :: Bool -> Style

-- | A style that sets the style to italics
withItlc :: Bool -> Style

-- | The identity transform.
defaultStyle :: StyleName
data Color
RGB :: {-# UNPACK #-} !Word8 -> {-# UNPACK #-} !Word8 -> {-# UNPACK #-} !Word8 -> Color

-- | The system-default color of the engine used. e.g. in Gtk this should
--   pick whatever the user has chosen as default color (background or
--   forground depending on usage) for the text.
Default :: Color

-- | Convert a color to its text specification, as to be accepted by
--   XParseColor
colorToText :: Color -> String
black :: Color
yellow :: Color
brown :: Color
green :: Color
darkgreen :: Color
red :: Color
darkred :: Color
lightGrey :: Color
grey :: Color
darkblue :: Color
brightwhite :: Color
white :: Color
cyan :: Color
darkcyan :: Color
magenta :: Color
purple :: Color
blue :: Color
instance Eq Color
instance Ord Color
instance Show Color
instance Eq Attributes
instance Ord Attributes
instance Show Attributes

module Yi.Dynamic

-- | Class of values that can go in a <tt>ConfigDynamic</tt> or a
--   <tt>ConfigDynamicValues</tt>. These will typically go in a
--   <tt>Config</tt>. As the <tt>Config</tt> has no mutable state, there is
--   no need to serialize these values: if needed, they will be set in the
--   user's configuration file. The <a>Initializable</a> constraint ensures
--   that, even if the user hasn't customised this config variable, a value
--   is stil available.
class (Initializable a, Typeable a) => YiConfigVariable a

-- | An "extensible record" of <a>YiConfigVariable</a>s. Can be constructed
--   and accessed with <a>initial</a> and <a>configVariableA</a>.
--   
--   This type can be thought of as a record containing <i>all</i>
--   <a>YiConfigVariable</a>s in existence.
data ConfigVariables

-- | Accessor for any <a>YiConfigVariable</a>. Neither reader nor writer
--   can fail: if the user's config file hasn't set a value for a
--   <a>YiConfigVariable</a>, then the default value is used.
configVariableA :: YiConfigVariable a => Accessor ConfigVariables a

-- | Class of values that can go in a <a>Dynamic</a> or a
--   <a>DynamicValues</a>. These are typically for storing custom state in
--   a <tt>FBuffer</tt> or an <tt>Editor</tt>.
class (Initializable a, Binary a, Typeable a) => YiVariable a

-- | An extensible record, indexed by type.
data DynamicValues

-- | Accessor for a dynamic component. If the component is not found, the
--   value <a>initial</a> is used.
dynamicValueA :: YiVariable a => Accessor DynamicValues a
instance Typeable Dynamic
instance Typeable DynamicValues
instance Monoid ConfigVariables
instance Monoid DynamicValues
instance Initializable DynamicValues
instance Binary DynamicValues
instance Binary Dynamic
instance Initializable ConfigVariables


-- | This is a library of interactive processes combinators, usable to
--   define extensible keymaps.
--   
--   (Inspired by the Parsec library, written by Koen Claessen)
--   
--   The processes are:
--   
--   <ul>
--   <li>composable: in parallel using <a>&lt;|&gt;</a>, in sequence using
--   monadic bind.</li>
--   <li>extensible: it is always possible to override a behaviour by
--   combination of <a>adjustPriority</a> and <a>&lt;|&gt;</a>. (See also
--   <a>&lt;||</a> for a convenient combination of the two.)</li>
--   <li>monadic: sequencing is done via monadic bind. (leveraging the
--   whole battery of monadic tools that Haskell provides)</li>
--   </ul>
--   
--   The processes can parse input, and write output that depends on it.
--   
--   The semantics are quite obvious; only disjunction deserve a bit more
--   explanation:
--   
--   in <tt>p = (a <a>&lt;|&gt;</a> b)</tt>, what happens if <tt>a</tt> and
--   <tt>b</tt> recognize the same input (prefix), but produce conflicting
--   output?
--   
--   <ul>
--   <li>if the output is the same (as by the PEq class), then the
--   processes (prefixes) are <a>merged</a> * if a Write is more
--   prioritized than the other, the one with low priority will be
--   discarded * otherwise, the output will be delayed until one of the
--   branches can be discarded. * if there is no way to disambiguate, then
--   no output will be generated anymore. This situation can be detected by
--   using <tt>possibleActions</tt> however.</li>
--   </ul>
module Yi.Interact

-- | Interactive process description
data I ev w a

-- | Operational representation of a process
data P event w
End :: P event w
Chain :: (P event mid) -> (P mid w) -> P event w

-- | Abstraction of the automaton state.
data InteractState event w
Ambiguous :: [(Int, w, P event w)] -> InteractState event w
Waiting :: InteractState event w
Dead :: InteractState event w
Running :: w -> (P event w) -> InteractState event w

-- | Abstraction of monadic interactive processes
class (PEq w, Monad m, Alternative m, Applicative m, MonadPlus m) => MonadInteract m w e | m -> w e
write :: MonadInteract m w e => w -> m ()
eventBounds :: (MonadInteract m w e, Ord e) => Maybe e -> Maybe e -> m e
adjustPriority :: MonadInteract m w e => Int -> m ()
class PEq a
equiv :: PEq a => a -> a -> Bool
deprioritize :: MonadInteract f w e => f ()
(<||) :: MonadInteract f w e => f a -> f a -> f a
(||>) :: MonadInteract f w e => f a -> f a -> f a

-- | <tt>option x p</tt> will either parse <tt>p</tt> or return <tt>x</tt>
--   without consuming any input.
option :: MonadInteract m w e => a -> m a -> m a
oneOf :: (Ord event, MonadInteract m w event) => [event] -> m event
processOneEvent :: PEq w => P event w -> event -> ([w], P event w)
computeState :: PEq w => P event w -> InteractState event w

-- | Parses and returns the specified character.
event :: (Ord event, MonadInteract m w event) => event -> m event

-- | Parses and returns the specified list of events (lazily).
events :: (Ord event, MonadInteract m w event) => [event] -> m [event]

-- | Combines all parsers in the specified list.
choice :: MonadInteract m w e => [m a] -> m a
mkAutomaton :: PEq w => I ev w a -> P ev w
idAutomaton :: (Ord a, PEq a) => P a a
runWrite :: PEq w => P event w -> [event] -> [w]
anyEvent :: (Ord event, MonadInteract m w event) => m event
eventBetween :: (Ord e, MonadInteract m w e) => e -> e -> m e
accepted :: Show ev => Int -> P ev w -> [[String]]
instance (Show w, Show ev) => Show (P ev w)
instance Monoid (InteractState event w)
instance PEq w => MonadInteract (I event w) w event
instance PEq w => MonadPlus (I event w)
instance Monad (I event w)
instance Alternative (I ev w)
instance Applicative (I ev w)
instance Functor (I event w)
instance MonadInteract m w e => MonadInteract (StateT s m) w e

module Yi.Keymap.Vim2.Digraph
charFromDigraph :: [(String, Char)] -> Char -> Char -> Maybe Char
defDigraphs :: [(String, Char)]

module Yi.Keymap.Vim2.MatchResult
data MatchResult a
NoMatch :: MatchResult a
PartialMatch :: MatchResult a
WholeMatch :: a -> MatchResult a
lookupBestMatch :: String -> [(String, a)] -> MatchResult a
matchesString :: String -> String -> MatchResult ()
instance Show (MatchResult a)
instance Alternative MatchResult
instance Applicative MatchResult
instance Functor MatchResult


-- | Basic types useful everywhere we play with buffers.
module Yi.Buffer.Basic

-- | Direction of movement inside a buffer
data Direction
Backward :: Direction
Forward :: Direction
reverseDir :: Direction -> Direction

-- | reverse if Backward
mayReverse :: Direction -> [a] -> [a]

-- | <tt>direction</tt> is in the same style of <tt>maybe</tt> or
--   <tt>either</tt> functions, It takes one argument per direction
--   (backward, then forward) and a direction to select the output.
directionElim :: Direction -> a -> a -> a

-- | A mark in a buffer
newtype Mark
Mark :: Int -> Mark
markId :: Mark -> Int

-- | Reference to a buffer.
newtype BufferRef
BufferRef :: Int -> BufferRef

-- | A point in a buffer
newtype Point
Point :: Int -> Point
fromPoint :: Point -> Int

-- | Size of a buffer region
newtype Size
Size :: Int -> Size
fromSize :: Size -> Int
fromString :: String -> Rope

-- | Window references
newtype WindowRef
WindowRef :: Int -> WindowRef
unWindowRef :: WindowRef -> Int
instance Typeable Mark
instance Typeable BufferRef
instance Typeable Point
instance Typeable WindowRef
instance Integral Point
instance Real Point
instance Num Point
instance Num BufferRef
instance Eq Mark
instance Ord Mark
instance Show Mark
instance Binary Mark
instance Eq BufferRef
instance Ord BufferRef
instance Binary BufferRef
instance Eq Point
instance Ord Point
instance Enum Point
instance Bounded Point
instance Binary Point
instance Ix Point
instance Show Size
instance Eq Size
instance Ord Size
instance Num Size
instance Enum Size
instance Real Size
instance Integral Size
instance Binary Size
instance Eq WindowRef
instance Ord WindowRef
instance Enum WindowRef
instance Show WindowRef
instance Binary WindowRef
instance Initializable WindowRef
instance SemiNum Point Size
instance Show Point
instance Show BufferRef
instance Binary Direction
instance Typeable Direction
instance Eq Direction
instance Ord Direction
instance Show Direction
instance Bounded Direction
instance Enum Direction

module Yi.Regex
data SearchOption

-- | Compile for matching that ignores char case
IgnoreCase :: SearchOption

-- | Compile for newline-insensitive matching
NoNewLine :: SearchOption

-- | Treat the input not as a regex but as a literal string to search for.
QuoteRegex :: SearchOption
makeSearchOptsM :: [SearchOption] -> String -> Either String SearchExp
data SearchExp
SearchExp :: String -> Regex -> Regex -> [SearchOption] -> SearchExp
seInput :: SearchExp -> String
seCompiled :: SearchExp -> Regex
seBackCompiled :: SearchExp -> Regex
seOptions :: SearchExp -> [SearchOption]
searchString :: SearchExp -> String
searchRegex :: Direction -> SearchExp -> Regex
emptySearch :: SearchExp

-- | The regular expression that matches nothing.
emptyRegex :: Regex

-- | Return an escaped (for parseRegex use) version of the string.
regexEscapeString :: String -> String
instance Uniplate Pattern
instance Binary SearchExp
instance Binary SearchOption
instance Eq SearchOption


-- | This module defines the Region ADT
module Yi.Region

-- | The region data type. The region is semi open: it includes the start
--   but not the end bound. This allows simpler region-manipulation
--   algorithms. Invariant : regionStart r &lt;= regionEnd r
data Region

-- | The empty region
emptyRegion :: Region
regionIsEmpty :: Region -> Bool

-- | Construct a region from its bounds, emacs style: the right bound is
--   excluded
mkRegion :: Point -> Point -> Region
mkRegion' :: Direction -> Point -> Point -> Region
mkSizeRegion :: Point -> Size -> Region
regionStart :: Region -> Point
regionEnd :: Region -> Point
regionSize :: Region -> Size
regionDirection :: Region -> Direction

-- | True if the given point is inside the given region.
inRegion :: Point -> Region -> Bool

-- | True if the given point is inside the given region or at the end of
--   it.
nearRegion :: Point -> Region -> Bool

-- | Returns if a region (1st arg) is included in another (2nd arg)
includedRegion :: Region -> Region -> Bool
fmapRegion :: (Point -> Point) -> Region -> Region

-- | Take the intersection of two regions
intersectRegion :: Region -> Region -> Region

-- | Take the union of two regions (including what is between them)
unionRegion :: Region -> Region -> Region
regionFirst :: Region -> Point
regionLast :: Region -> Point
regionsOverlap :: Bool -> Region -> Region -> Bool
instance Show Region
instance Binary Region
instance Typeable Region


-- | This module defines a common interface for syntax-awareness.
module Yi.Syntax

-- | The main type of syntax highlighters. This record type combines all
--   the required functions, and is parametrized on the type of the
--   internal state.
data Highlighter cache syntax
SynHL :: cache -> (Scanner Point Char -> Point -> cache -> cache) -> (cache -> WindowRef -> syntax) -> (Map WindowRef Region -> cache -> cache) -> Highlighter cache syntax

-- | The start state for the highlighter.
hlStartState :: Highlighter cache syntax -> cache
hlRun :: Highlighter cache syntax -> Scanner Point Char -> Point -> cache -> cache
hlGetTree :: Highlighter cache syntax -> cache -> WindowRef -> syntax

-- | focus at a given point, and return the coresponding node. (hint -- the
--   root can always be returned, at the cost of performance.)
hlFocus :: Highlighter cache syntax -> Map WindowRef Region -> cache -> cache
data Cache state result
data Scanner st a
Scanner :: st -> (st -> Point) -> a -> (st -> [(st, a)]) -> Scanner st a

-- | Initial state
scanInit :: Scanner st a -> st

-- | How far did the scanner look to produce this intermediate state? The
--   state can be reused as long as nothing changes before that point.
scanLooked :: Scanner st a -> st -> Point
scanEmpty :: Scanner st a -> a

-- | Running function returns a list of results and intermediate states.
--   Note: the state is the state <i>before</i> producing the result in the
--   second component.
scanRun :: Scanner st a -> st -> [(st, a)]
data ExtHL syntax
ExtHL :: (Highlighter cache syntax) -> ExtHL syntax
noHighlighter :: Highlighter () syntax

-- | This takes as input a scanner that returns the <a>full</a> result at
--   each element in the list; perhaps in a different form for the purpose
--   of incremental-lazy eval.
mkHighlighter :: Show state => (Scanner Point Char -> Scanner state result) -> Highlighter (Cache state result) result
skipScanner :: Int -> Scanner st a -> Scanner st a
emptyFileScan :: Scanner Point Char

-- | A point in a buffer
newtype Point
Point :: Int -> Point
fromPoint :: Point -> Int

-- | Size of a buffer region
newtype Size
Size :: Int -> Size
fromSize :: Size -> Int
type Length = Int
type Stroke = Span StyleName
data Span a
Span :: !Point -> !a -> !Point -> Span a
spanBegin :: Span a -> !Point
spanContents :: Span a -> !a
spanEnd :: Span a -> !Point
instance Show a => Show (Span a)
instance Functor (Scanner st)
instance Functor Span
instance Foldable Span
instance Traversable Span


-- | Utilities to turn a lexer generated by Alex into a scanner that can be
--   used by Yi.
module Yi.Lexer.Alex
type AlexInput = (Char, IndexedStr)
alexGetChar :: AlexInput -> Maybe (Char, AlexInput)
alexInputPrevChar :: AlexInput -> Char

-- | Lexer state
data AlexState lexerState
AlexState :: lexerState -> !Point -> !Posn -> AlexState lexerState
stLexer :: AlexState lexerState -> lexerState
lookedOffset :: AlexState lexerState -> !Point
stPosn :: AlexState lexerState -> !Posn

-- | unfold lexer function into a function that returns a stream of (state
--   x token)
unfoldLexer :: ((AlexState lexState, input) -> Maybe (token, (AlexState lexState, input))) -> (AlexState lexState, input) -> [(AlexState lexState, token)]

-- | Combine a character scanner with a lexer to produce a token scanner.
--   May be used together with <tt>mkHighlighter</tt> to produce a
--   <a>Highlighter</a>, or with <tt>linearSyntaxMode</tt> to produce a
--   <tt>Mode</tt>.
lexScanner :: ((AlexState lexerState, AlexInput) -> Maybe (token, (AlexState lexerState, AlexInput))) -> lexerState -> Scanner Point Char -> Scanner (AlexState lexerState) token
alexCollectChar :: AlexInput -> [Char]

-- | Return a constant token
actionConst :: token -> Action lexState token

-- | Return a constant token, and modify the lexer state
actionAndModify :: (lexState -> lexState) -> token -> Action lexState token

-- | Convert the parsed string into a token, and also modify the lexer
--   state
actionStringAndModify :: (lexState -> lexState) -> (String -> token) -> Action lexState token

-- | Convert the parsed string into a token
actionStringConst :: (String -> token) -> Action lexState token
data Tok t
Tok :: t -> Size -> Posn -> Tok t
tokT :: Tok t -> t
tokLen :: Tok t -> Size
tokPosn :: Tok t -> Posn
tokBegin :: Tok t -> Point
tokEnd :: Tok t -> Point
tokFromT :: t -> Tok t
tokRegion :: Tok t -> Region
data Posn
Posn :: !Point -> !Int -> !Int -> Posn
posnOfs :: Posn -> !Point
posnLine :: Posn -> !Int
posnCol :: Posn -> !Int
startPosn :: Posn
moveStr :: Posn -> IndexedStr -> Posn
type ASI s = (AlexState s, AlexInput)
(+~) :: SemiNum absolute relative => absolute -> relative -> absolute
(~-) :: SemiNum absolute relative => absolute -> absolute -> relative

-- | Size of a buffer region
newtype Size
Size :: Int -> Size
fromSize :: Size -> Int
type Stroke = Span StyleName
tokToSpan :: Tok t -> Span t
alexGetByte :: AlexInput -> Maybe (Word8, AlexInput)
instance Eq Posn
instance Ix Posn
instance Show lexerState => Show (AlexState lexerState)
instance Show Posn
instance Ord Posn
instance Show t => Show (Tok t)
instance Functor Tok

module Yi.IncrementalParse

-- | Parse the same thing as the argument, but will be used only as backup.
--   ie, it will be used only if disjuncted with a failing parser.
recoverWith :: Parser s a -> Parser s a
symbol :: (s -> Bool) -> Parser s s
eof :: Parser s ()
lookNext :: Parser s (Maybe s)
testNext :: (Maybe s -> Bool) -> Parser s ()
type State st token result = (st, Process token result)
type P s a = Parser s a

-- | Parser specification
data Parser s a
Look :: Parser s a -> (s -> Parser s a) -> Parser s a
Yuck :: Parser s a -> Parser s a
Enter :: String -> Parser s a -> Parser s a

-- | Lexer state
data AlexState lexerState
AlexState :: lexerState -> !Point -> !Posn -> AlexState lexerState
stLexer :: AlexState lexerState -> lexerState
lookedOffset :: AlexState lexerState -> !Point
stPosn :: AlexState lexerState -> !Posn
scanner :: Parser token result -> Scanner st token -> Scanner (State st token result) result

module Yi.Lexer.Abella
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
tokenToStyle :: Token -> StyleName
tokenToText :: Token -> Maybe String
type TT = Tok Token
isComment :: Token -> Bool
data Token
Number :: Token
VarIdent :: Token
ConsIdent :: Token
Reserved :: !Reserved -> Token
ReservedOp :: !ReservedOp -> Token
CommentLine :: Token
Skip :: Token
Unrecognized :: Token
type HlState = Int
data Reserved
Forall :: Reserved
Exists :: Reserved
Other :: Reserved
data ReservedOp
Or :: ReservedOp
And :: ReservedOp
BackSlash :: ReservedOp
RightArrow :: ReservedOp
DoubleRightArrow :: ReservedOp
Dot :: ReservedOp
OtherOp :: ReservedOp
instance Eq Reserved
instance Show Reserved
instance Eq ReservedOp
instance Show ReservedOp
instance Eq Token
instance Show Token
instance Functor AlexLastAcc

module Yi.Lexer.Cabal
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.Compilation
initState :: ()

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
data Token
Report :: String -> Int -> Int -> String -> Token
Text :: String -> Token
instance Show Token
instance Functor AlexLastAcc

module Yi.Lexer.Haskell
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
tokenToStyle :: Token -> StyleName
tokenToText :: Token -> Maybe String
type TT = Tok Token
isErrorTok :: Token -> Bool
isSpecial :: String -> Token -> Bool
startsLayout :: Token -> Bool
isComment :: Token -> Bool
data Token
Number :: Token
CharTok :: Token
StringTok :: Token
VarIdent :: Token
ConsIdent :: Token
Reserved :: !ReservedType -> Token
ReservedOp :: !OpType -> Token
Special :: Char -> Token
ConsOperator :: String -> Token
Operator :: String -> Token
Comment :: !CommentType -> Token
THQuote :: Token
CppDirective :: Token
Unrecognized :: Token
type HlState = Int
data CommentType
Open :: CommentType
Close :: CommentType
Text :: CommentType
Line :: CommentType
data ReservedType
Hiding :: ReservedType
Qualified :: ReservedType
As :: ReservedType
Import :: ReservedType
Data :: ReservedType
NewType :: ReservedType
Type :: ReservedType
Where :: ReservedType
Let :: ReservedType
In :: ReservedType
Do :: ReservedType
Of :: ReservedType
OtherLayout :: ReservedType
Deriving :: ReservedType
Module :: ReservedType
Forall :: ReservedType
Other :: ReservedType
Class :: ReservedType
Instance :: ReservedType
data OpType
Pipe :: OpType
Equal :: OpType
BackSlash :: OpType
LeftArrow :: OpType
RightArrow :: OpType
DoubleRightArrow :: OpType
DoubleColon :: OpType
DoubleDot :: OpType
Arobase :: OpType
Tilda :: OpType
instance Eq CommentType
instance Show CommentType
instance Eq ReservedType
instance Show ReservedType
instance Eq OpType
instance Show OpType
instance Eq Token
instance Show Token
instance Functor AlexLastAcc

module Yi.Lexer.JavaScript
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))

-- | Takes a <a>Token</a> and returns a style to be used for that type of
--   token.
--   
--   TODO: The <a>elem</a> check is potentially unnecessarily slow. We
--   could split the Const constructor into two different ones, one for
--   builtins and one for others.
tokenToStyle :: Token -> UIStyle -> Style
type TT = Tok Token

-- | The different tokens.
data Token
Unknown :: Token
Res :: !Reserved -> Token
Str :: !String -> Token
Rex :: !String -> Token
Op :: !Operator -> Token
Special :: !Char -> Token
Number :: !String -> Token
ValidName :: !String -> Token
Comment :: !CommentType -> Token
Const :: !String -> Token

-- | The constructors for <tt>Reserved</tt> have an apostrophe as a suffix
--   because <tt>Default</tt> is already used. Also note that
--   <tt>Undefined'</tt> is not intended as some sort of <a>backup</a>
--   reserved word for things we don't care about -- it really means the
--   <a>undefined</a> built-in in JavaScript.
data Reserved
Break' :: Reserved
Case' :: Reserved
Catch' :: Reserved
Continue' :: Reserved
Default' :: Reserved
Delete' :: Reserved
Do' :: Reserved
Else' :: Reserved
Finally' :: Reserved
For' :: Reserved
Function' :: Reserved
If' :: Reserved
In' :: Reserved
InstanceOf' :: Reserved
New' :: Reserved
Return' :: Reserved
Switch' :: Reserved
This' :: Reserved
Throw' :: Reserved
Try' :: Reserved
TypeOf' :: Reserved
Var' :: Reserved
Void' :: Reserved
While' :: Reserved
With' :: Reserved
True' :: Reserved
False' :: Reserved
Null' :: Reserved
Undefined' :: Reserved

-- | The constructors for <tt>Operator</tt> have an apostrophe as a suffix
--   because e.g. <tt>LT</tt> is already used by <tt>Prelude</tt>.
data Operator
Add' :: Operator
Subtract' :: Operator
Multiply' :: Operator
Divide' :: Operator
Modulo' :: Operator
Increment' :: Operator
Decrement' :: Operator
Assign' :: Operator
AddAssign' :: Operator
SubtractAssign' :: Operator
MultiplyAssign' :: Operator
DivideAssign' :: Operator
ModuloAssign' :: Operator
Equals' :: Operator
NotEquals' :: Operator
GT' :: Operator
GTE' :: Operator
LT' :: Operator
LTE' :: Operator
EqualsType' :: Operator
NotEqualsType' :: Operator
And' :: Operator
Or' :: Operator
Not' :: Operator
BitAnd' :: Operator
BitOr' :: Operator
BitXor' :: Operator
LeftShift' :: Operator
RightShift' :: Operator
RightShiftZ' :: Operator
BitNot' :: Operator
Qualify' :: Operator

-- | <tt>HlState</tt> is 0 when outside of a multi-line comment and -1 when
--   inside one.
type HlState = Int

-- | Prefix operators. NOTE: Add' is also a valid prefix operator, but
--   since it's completely useless in the real world, we don't care about
--   it here. Doing this makes parsing much, much easier.
prefixOperators :: [Operator]

-- | Infix operators.
infixOperators :: [Operator]

-- | Postfix operators.
postfixOperators :: [Operator]
instance Show CommentType
instance Eq CommentType
instance Show Reserved
instance Eq Reserved
instance Show Operator
instance Eq Operator
instance Show Token
instance Eq Token
instance Functor AlexLastAcc

module Yi.Lexer.JSON
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
type Token = StyleName
instance Functor AlexLastAcc

module Yi.Lexer.Latex
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
data Token
Comment :: Token
Text :: Token
Special :: !Char -> Token
Command :: !String -> Token
Begin :: !String -> Token
End :: !String -> Token
NewCommand :: Token
type HlState = Int
tokenToText :: Token -> Maybe [Char]
instance Eq Token
instance Show Token
instance Ord Token
instance Functor AlexLastAcc

module Yi.Lexer.LiterateHaskell
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
data HlState
instance Eq HlState
instance Show HlState
instance Functor AlexLastAcc

module Yi.Lexer.GitCommit
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
type Token = StyleName
instance Show HlState
instance Eq HlState
instance Functor AlexLastAcc

module Yi.Lexer.GNUMake
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Show HlState
instance Functor AlexLastAcc

module Yi.Lexer.OCaml
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
tokenToStyle :: Token -> StyleName
data Token
Number :: Token
CharTok :: Token
StringTok :: Token
VarIdent :: Token
ConsIdent :: Token
IndentReserved :: Token
Reserved :: Token
ReservedOp :: Token
Special :: Char -> Token
ConsOperator :: Token
Operator :: Token
Comment :: Token
instance Eq Token
instance Show Token
instance Functor AlexLastAcc

module Yi.Lexer.Ott
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.SVNCommit
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Show HlState
instance Functor AlexLastAcc

module Yi.Lexer.Whitespace
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.C
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.ObjectiveC
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.Cplusplus
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.Java
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.Perl
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Show HlState
instance Functor AlexLastAcc

module Yi.Lexer.Python
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.Ruby
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Lexer.Srmc
initState :: HlState

-- | Scan one token. Return (maybe) a token and a new state.
alexScanToken :: (AlexState HlState, AlexInput) -> Maybe (Tok Token, (AlexState HlState, AlexInput))
instance Functor AlexLastAcc

module Yi.Syntax.Layout

-- | Transform a scanner into a scanner that also adds opening, closing and
--   <a>next</a> tokens to indicate layout.
layoutHandler :: (Show t, Eq t) => (t -> Bool) -> [(t, t)] -> (Tok t -> Bool) -> (t, t, t) -> (Tok t -> Bool) -> Scanner (AlexState lexState) (Tok t) -> Scanner (State t lexState) (Tok t)
type State t lexState = (IState t, AlexState lexState)
instance Show t => Show (BlockOpen t)
instance Show t => Show (IState t)

module Yi.KillRing
data Killring
krKilled :: Killring -> Bool
krContents :: Killring -> [String]

-- | Finish an atomic command, for the purpose of killring accumulation.
krEndCmd :: Killring -> Killring

-- | Put some text in the killring. It's accumulated if the last command
--   was a kill too
krPut :: Direction -> String -> Killring -> Killring

-- | Set the top of the killring. Never accumulate the previous content.
krSet :: String -> Killring -> Killring

-- | Get the top of the killring.
krGet :: Killring -> String
krEmpty :: Killring
instance Binary Killring
instance Show Killring

module Yi.JumpList
type JumpList = Maybe (PointedList Jump)
data Jump
Jump :: Mark -> BufferRef -> Jump
jumpMark :: Jump -> Mark
jumpBufferRef :: Jump -> BufferRef
addJump :: Jump -> JumpList -> JumpList
jumpBack :: JumpList -> JumpList
jumpForward :: JumpList -> JumpList
instance Show Jump
instance Binary Jump

module Yi.Window

-- | A window onto a buffer.
data Window
Window :: !Bool -> !BufferRef -> ![BufferRef] -> Int -> Region -> !WindowRef -> Int -> JumpList -> Window

-- | regular or mini window?
isMini :: Window -> !Bool

-- | the buffer this window opens to
bufkey :: Window -> !BufferRef

-- | list of last accessed buffers (former bufKeys). Last accessed one is
--   first element
bufAccessList :: Window -> ![BufferRef]

-- | height of the window (in number of screen lines displayed)
height :: Window -> Int

-- | view area. note that the top point is also available as a buffer mark.
winRegion :: Window -> Region

-- | identifier for the window (for UI sync) This is required for accurate
--   scrolling. Scrolling depends on the actual number of buffer lines
--   displayed. Line wrapping changes that number relative to the height so
--   we can't use height for that purpose.
wkey :: Window -> !WindowRef

-- | The actual number of buffer lines displayed. Taking into account line
--   wrapping
actualLines :: Window -> Int
jumpList :: Window -> JumpList

-- | Get the identification of a window.
winkey :: Window -> (Bool, BufferRef)

-- | Return a <a>fake</a> window onto a buffer.
dummyWindow :: BufferRef -> Window
instance Typeable Window
instance Eq Window
instance Show Window
instance Binary Window

module Yi.Tab

-- | A tab, containing a collection of windows.
data Tab
type TabRef = Int

-- | Accessor for the windows. If the windows (but not the focus) have
--   changed when setting, then a relayout will be triggered to preserve
--   the internal invariant.
tabWindowsA :: Accessor Tab (PointedList Window)

-- | Accessor for the layout manager. When setting, will trigger a relayout
--   if the layout manager has changed.
tabLayoutManagerA :: Accessor Tab AnyLayoutManager

-- | Gets / sets the position of the divider with the given reference. The
--   caller must ensure that the DividerRef is valid, otherwise an error
--   will (might!) occur.
tabDividerPositionA :: DividerRef -> Accessor Tab DividerPosition

-- | For UI sync; fixes #304
tkey :: Tab -> TabRef

-- | Returns a list of all mini windows associated with the given tab
tabMiniWindows :: Tab -> [Window]
tabFocus :: Tab -> Window

-- | Forces all windows in the tab
forceTab :: Tab -> Tab

-- | A specialised version of <a>fmap</a>.
mapWindows :: (Window -> Window) -> Tab -> Tab

-- | Current layout. Invariant: must be the layout generated by
--   <a>tabLayoutManager</a>, up to changing the <a>divPos</a>s.
tabLayout :: Tab -> (Layout WindowRef)

-- | Folds over the windows in the tab
tabFoldl :: (a -> Window -> a) -> a -> Tab -> a

-- | Make a tab from multiple windows
makeTab :: TabRef -> PointedList Window -> Tab

-- | Make a tab from one window
makeTab1 :: TabRef -> Window -> Tab
instance Typeable Tab
instance Show Tab
instance Eq Tab
instance Binary Tab


-- | Generic syntax tree handling functions
module Yi.Syntax.Tree
class Foldable tree => IsTree tree where subtrees = fst . uniplate
subtrees :: IsTree tree => tree t -> [tree t]
uniplate :: IsTree tree => tree t -> ([tree t], [tree t] -> tree t)
emptyNode :: IsTree tree => tree t
toksAfter :: Foldable t1 => t -> t1 a -> [a]
allToks :: Foldable t => t a -> [a]
tokAtOrBefore :: Foldable t => Point -> t (Tok t1) -> Maybe (Tok t1)
toksInRegion :: Foldable t1 => Region -> t1 (Tok t) -> [Tok t]
sepBy :: Alternative f => f a -> f v -> f [a]
sepBy1 :: Alternative f => f a -> f v -> f [a]
getLastOffset :: Foldable t => t (Tok t1) -> Point
getFirstOffset :: Foldable t => t (Tok t1) -> Point

-- | Return the 1st token of a subtree.
getFirstElement :: Foldable t => t a -> Maybe a

-- | Return the last token of a subtree.
getLastElement :: Foldable t => t a -> Maybe a

-- | Search the given list, and return the last tree before the given
--   point; with path to the root. (Root is at the start of the path)
getLastPath :: IsTree tree => [tree (Tok t)] -> Point -> Maybe [tree (Tok t)]

-- | Return all subtrees in a tree, in preorder.
getAllSubTrees :: IsTree tree => tree t -> [tree t]
tokenBasedAnnots :: Foldable t1 => (a1 -> Maybe a) -> t1 a1 -> t -> [a]
tokenBasedStrokes :: Foldable t3 => (a -> b) -> t3 a -> t -> t2 -> t1 -> [b]
subtreeRegion :: Foldable t => t (Tok t1) -> Region

-- | Search the tree in pre-order starting at a given node, until finding a
--   leaf which is at or after the given point. An effort is also made to
--   return a leaf as close as possible to <tt>p</tt>. TODO: rename to
--   fromLeafToLeafAt
fromLeafToLeafAfter :: IsTree tree => Point -> Node (tree (Tok a)) -> Node (tree (Tok a))

-- | Given an approximate path to a leaf at the end of the region, return:
--   (path to leaf at the end of the region,path from focused node to the
--   leaf, small node encompassing the region)
fromNodeToFinal :: IsTree tree => Region -> Node (tree (Tok a)) -> Node (tree (Tok a))
instance Show a => Show (Test a)
instance Eq a => Eq (Test a)
instance Show NTTT
instance Arbitrary NTTT
instance Arbitrary Region
instance Eq (Tok a)
instance Arbitrary (Test TT)
instance IsTree Test
instance Foldable Test

module Yi.Syntax.Haskell
type PModule = Exp
type PModuleDecl = Exp
type PImport = Exp

-- | Exp can be expression or declaration
data Exp t
PModule :: [t] -> (Maybe (PModule t)) -> Exp t
comments :: Exp t -> [t]
progMod :: Exp t -> (Maybe (PModule t))
ProgMod :: (PModuleDecl t) -> (PModule t) -> Exp t
modDecl :: Exp t -> (PModuleDecl t)

-- | The module declaration part
body :: Exp t -> (PModule t)
Body :: Exp t -> (Block t) -> (Block t) -> Exp t
imports :: Exp t -> Exp t
content :: Exp t -> (Block t)

-- | The body of the module
extraContent :: Exp t -> (Block t)
PModuleDecl :: (PAtom t) -> (PAtom t) -> (Exp t) -> (Exp t) -> Exp t
moduleKeyword :: Exp t -> (PAtom t)
name :: Exp t -> (PAtom t)
exports :: Exp t -> (Exp t)
whereKeyword :: Exp t -> (Exp t)
PImport :: (PAtom t) -> (Exp t) -> (PAtom t) -> (Exp t) -> (Exp t) -> Exp t
importKeyword :: Exp t -> (PAtom t)
qual :: Exp t -> (Exp t)
name' :: Exp t -> (PAtom t)
as :: Exp t -> (Exp t)
specification :: Exp t -> (Exp t)

-- | Type signature
TS :: t -> [Exp t] -> Exp t

-- | Type declaration
PType :: (PAtom t) -> (Exp t) -> (PAtom t) -> (Exp t) -> Exp t
typeKeyword :: Exp t -> (PAtom t)
typeCons :: Exp t -> (Exp t)
equal :: Exp t -> (PAtom t)
btype :: Exp t -> (Exp t)

-- | Data declaration
PData :: (PAtom t) -> (Exp t) -> (Exp t) -> (Exp t) -> Exp t
dataKeyword :: Exp t -> (PAtom t)
dtypeCons :: Exp t -> (Exp t)
dEqual :: Exp t -> (Exp t)
dataRhs :: Exp t -> (Exp t)
PData' :: (PAtom t) -> (Exp t) -> Exp t
dEqual :: Exp t -> (PAtom t)

-- | Data declaration RHS
dataCons :: Exp t -> (Exp t)
PClass :: (PAtom t) -> (Exp t) -> (Exp t) -> Exp t
cKeyword :: Exp t -> (PAtom t)
cHead :: Exp t -> (Exp t)

-- | Class declaration
cwhere :: Exp t -> (Exp t)

-- | A parenthesized, bracked or braced
Paren :: (PAtom t) -> [Exp t] -> (PAtom t) -> Exp t

-- | A block of things separated by layout
Block :: [Exp t] -> Exp t

-- | An atom is a token followed by many comments
PAtom :: t -> [t] -> Exp t
Expr :: [Exp t] -> Exp t

-- | Where clause
PWhere :: (PAtom t) -> (Exp t) -> (Exp t) -> Exp t
Bin :: (Exp t) -> (Exp t) -> Exp t
PError :: t -> t -> [t] -> Exp t
errorTok :: Exp t -> t
marker :: Exp t -> t

-- | An wrapper for errors
commentList :: Exp t -> [t]

-- | Righthandside of functions with =
RHS :: (PAtom t) -> (Exp t) -> Exp t

-- | An optional
Opt :: (Maybe (Exp t)) -> Exp t

-- | Module identifier
Modid :: t -> [t] -> Exp t
Context :: (Exp t) -> (Exp t) -> (PAtom t) -> Exp t

-- | Righthandside of functions with | the PAtom in PGuard' does not
--   contain any comments
PGuard :: [PGuard t] -> Exp t
PGuard' :: (PAtom t) -> (Exp t) -> (PAtom t) -> Exp t

-- | Type constructor data constructor same as with the TC constructor
TC :: (Exp t) -> Exp t

-- | Data constructor
DC :: (Exp t) -> Exp t

-- | let expression
PLet :: (PAtom t) -> (Exp t) -> (Exp t) -> Exp t
PIn :: t -> [Exp t] -> Exp t
type Tree = PModule

-- | The parser
parse :: P TT (Tree TT)
indentScanner :: Scanner (AlexState lexState) (TT) -> Scanner (State Token lexState) (TT)
instance IsTree Exp
instance Foldable Exp
instance Show t => Show (Exp t)

module Yi.Syntax.Strokes.Haskell
getStrokes :: Point -> Point -> Point -> Tree TT -> [Stroke]
tokenToAnnot :: TT -> Maybe (Span String)


-- | Parser for haskell that takes in account only parenthesis and layout
module Yi.Syntax.Paren
indentScanner :: Scanner (AlexState lexState) (TT) -> Scanner (State Token lexState) (TT)
isBrace :: TT -> Bool
ignoredToken :: TT -> Bool
isNoise :: Token -> Bool
type Expr t = [Tree t]
data Tree t
Paren :: t -> (Expr t) -> t -> Tree t
Block :: ([Tree t]) -> Tree t
Atom :: t -> Tree t
Error :: t -> Tree t
Expr :: [Tree t] -> Tree t

-- | Search the given list, and return the 1st tree after the given point
--   on the given line. This is the tree that will be moved if something is
--   inserted at the point. Precondition: point is in the given line.
getIndentingSubtree :: Tree TT -> Point -> Int -> Maybe (Tree TT)

-- | Given a tree, return (first offset, number of lines).
getSubtreeSpan :: Tree TT -> (Point, Int)
parse :: P TT (Tree TT)
parse' :: (TT -> Token) -> (Token -> TT) -> P TT [Tree TT]
getStrokes :: Point -> Point -> Point -> Tree TT -> [Stroke]
tokenToStroke :: TT -> Stroke
modStroke :: StyleName -> Stroke -> Stroke
tokenToAnnot :: TT -> Maybe (Span String)

-- | Create a special error token. (e.g. fill in where there is no correct
--   token to parse) Note that the position of the token has to be correct
--   for correct computation of node spans.
errTok :: Parser (Tok t) (Tok Token)
instance IsTree Tree
instance Foldable Tree
instance Show t => Show (Tree t)

module Yi.Syntax.Latex
isNoise :: Token -> Bool
type TT = Tok Token
type Expr t = [Tree t]
data Tree t
Paren :: t -> (Tree t) -> t -> Tree t
Atom :: t -> Tree t
Error :: t -> Tree t
Expr :: (Expr t) -> Tree t
parse :: P TT (Tree TT)
getStrokes :: Point -> Point -> Point -> Tree TT -> [Stroke]
modStroke :: StyleName -> Stroke -> Stroke
tokenToStroke :: TT -> Stroke
tokenToAnnot :: TT -> Maybe (Span String)
tokenToStyle :: Token -> StyleName
isSpecial :: [Char] -> Token -> Bool
isBegin :: Token -> Bool
isEnd :: Token -> Bool
isErrorTok :: Token -> Bool
instance Show t => Show (Tree t)
instance IsTree Tree
instance Foldable Tree

module Yi.Syntax.OnlineTree
data Tree a
Bin :: (Tree a) -> (Tree a) -> Tree a
Leaf :: a -> Tree a
Tip :: Tree a
manyToks :: P (Tok t) (Tree (Tok t))
tokAtOrBefore :: Foldable t => Point -> t (Tok t1) -> Maybe (Tok t1)
instance (Show x, Show (f x)) => Show (MaybeOneMore f x)
instance Show a => Show (Tree a)
instance Functor Tree
instance Foldable Tree
instance Traversable Tree
instance IsTree Tree
instance Arbitrary Point


-- | This module defines implementations of syntax-awareness drivers.
module Yi.Syntax.Driver
type Path = [Int]
data Cache state tree tt
Cache :: Map WindowRef Path -> [state] -> tree (Tok tt) -> !(Map WindowRef (tree (Tok tt))) -> Cache state tree tt
path :: Cache state tree tt -> Map WindowRef Path
cachedStates :: Cache state tree tt -> [state]
root :: Cache state tree tt -> tree (Tok tt)
focused :: Cache state tree tt -> !(Map WindowRef (tree (Tok tt)))
mkHighlighter :: (IsTree tree, Show state) => (Scanner Point Char -> Scanner state (tree (Tok tt))) -> Highlighter (Cache state tree tt) (tree (Tok tt))
unzipFM :: Ord k => [(k, (u, v))] -> (Map k u, Map k v)
zipWithFM :: Ord k => (u -> v -> w) -> v -> Map k u -> Map k v -> [(k, w)]

module Yi.Syntax.JavaScript

-- | Instances of <tt>Strokable</tt> are datatypes which can be syntax
--   highlighted.
class Strokable a
toStrokes :: Strokable a => a -> Endo [Stroke]

-- | Instances of <tt>Failable</tt> can represent failure. This is a useful
--   class for future work, since then we can make stroking much easier.
class Failable f
stupid :: Failable f => t -> f t
hasFailed :: Failable f => f t -> Bool
type BList a = [a]
type Tree t = BList (Statement t)
type Semicolon t = Maybe t
data Statement t
FunDecl :: t -> t -> (Parameters t) -> (Block t) -> Statement t
VarDecl :: t -> (BList (VarDecAss t)) -> (Semicolon t) -> Statement t
Return :: t -> (Maybe (Expr t)) -> (Semicolon t) -> Statement t
While :: t -> (ParExpr t) -> (Block t) -> Statement t
DoWhile :: t -> (Block t) -> t -> (ParExpr t) -> (Semicolon t) -> Statement t
For :: t -> t -> (Expr t) -> (ForContent t) -> t -> (Block t) -> Statement t
If :: t -> (ParExpr t) -> (Block t) -> (Maybe (Statement t)) -> Statement t
Else :: t -> (Block t) -> Statement t
With :: t -> (ParExpr t) -> (Block t) -> Statement t
Comm :: t -> Statement t
Expr :: (Expr t) -> (Semicolon t) -> Statement t
data Parameters t
Parameters :: t -> (BList t) -> t -> Parameters t
ParErr :: t -> Parameters t
data ParExpr t
ParExpr :: t -> (BList (Expr t)) -> t -> ParExpr t
ParExprErr :: t -> ParExpr t
data ForContent t
ForNormal :: t -> (Expr t) -> t -> (Expr t) -> ForContent t
ForIn :: t -> (Expr t) -> ForContent t
ForErr :: t -> ForContent t
data Block t
Block :: t -> (BList (Statement t)) -> t -> Block t
BlockOne :: (Statement t) -> Block t
BlockErr :: t -> Block t

-- | Represents either a variable name or a variable name assigned to an
--   expression. <tt>AssBeg</tt> is a variable name <i>maybe</i> followed
--   by an assignment. <tt>AssRst</tt> is an equals sign and an expression.
--   <tt>(AssBeg <tt>x</tt> (Just (AssRst '=' '5')))</tt> means <tt>x =
--   5</tt>.
data VarDecAss t
AssBeg :: t -> (Maybe (VarDecAss t)) -> VarDecAss t
AssRst :: t -> (Expr t) -> VarDecAss t
AssErr :: t -> VarDecAss t
data Expr t
ExprObj :: t -> (BList (KeyValue t)) -> t -> Expr t
ExprPrefix :: t -> (Expr t) -> Expr t
ExprNew :: t -> (Expr t) -> Expr t
ExprSimple :: t -> (Maybe (Expr t)) -> Expr t
ExprParen :: t -> (Expr t) -> t -> (Maybe (Expr t)) -> Expr t
ExprAnonFun :: t -> (Parameters t) -> (Block t) -> Expr t
ExprTypeOf :: t -> (Expr t) -> Expr t
ExprFunCall :: t -> (ParExpr t) -> (Maybe (Expr t)) -> Expr t
OpExpr :: t -> (Expr t) -> Expr t
ExprCond :: t -> (Expr t) -> t -> (Expr t) -> Expr t
ExprArr :: t -> (Maybe (Array t)) -> t -> (Maybe (Expr t)) -> Expr t
PostExpr :: t -> Expr t
ExprErr :: t -> Expr t
data Array t
ArrCont :: (Expr t) -> (Maybe (Array t)) -> Array t
ArrRest :: t -> (Array t) -> (Maybe (Array t)) -> Array t
ArrErr :: t -> Array t
data KeyValue t
KeyValue :: t -> t -> (Expr t) -> KeyValue t
KeyValueErr :: t -> KeyValue t

-- | Normal stroker.
normal :: TT -> Endo [Stroke]

-- | Error stroker.
error :: TT -> Endo [Stroke]
one :: (t -> a) -> t -> Endo [a]

-- | Given a new style and a stroke, return a stroke with the new style
--   appended to the old one.
modStroke :: StyleName -> Stroke -> Stroke

-- | Given a list of tokens to check for errors (<tt>xs</tt>) and a list of
--   tokens to stroke (<tt>xs'</tt>), returns normal strokes for
--   <tt>xs'</tt> if there were no errors. Otherwise returns error strokes
--   for <tt>xs'</tt>.
nError :: [TT] -> [TT] -> Endo [Stroke]

-- | Given a list of <tt>TT</tt>, if any of them is an error, returns an
--   error stroker, otherwise a normal stroker. Using e.g. existentials, we
--   could make this more general and have support for heterogeneous lists
--   of elements which implement Failable, but I haven't had the time to
--   fix this.
failStroker :: [TT] -> TT -> Endo [Stroke]

-- | Given a <tt>TT</tt>, return a <tt>Stroke</tt> for it.
tokenToStroke :: TT -> Stroke

-- | The main stroking function.
getStrokes :: Tree TT -> Point -> Point -> Point -> [Stroke]

-- | Main parser.
parse :: P TT (Tree TT)

-- | Parser for statements such as <a>return</a>, <a>while</a>,
--   <a>do-while</a>, <a>for</a>, etc.
statement :: P TT (Statement TT)

-- | Parser for <a>blocks</a>, i.e. a bunch of statements wrapped in curly
--   brackets <i>or</i> just a single statement.
--   
--   Note that this works for JavaScript 1.8 <a>lambda</a> style function
--   bodies as well, e.g. <a>function hello() 5</a>, since expressions are
--   also statements and we don't require a trailing semi-colon.
--   
--   TODO: function hello() var x; is not a valid program.
block :: P TT (Block TT)

-- | Parser for expressions which may be statements. In reality, any
--   expression is also a valid statement, but this is a slight compromise
--   to get rid of the massive performance loss which is introduced when
--   allowing JavaScript objects to be valid statements.
stmtExpr :: P TT (Expr TT)

-- | The basic idea here is to parse <a>the rest</a> of expressions, e.g.
--   <tt>+ 3</tt> in <tt>x + 3</tt> or <tt>[i]</tt> in <tt>x[i]</tt>.
--   Anything which is useful in such a scenario goes here. TODO: This
--   accepts [], but shouldn't, since x[] is invalid.
opExpr :: P TT (Expr TT)

-- | Parser for expressions.
expression :: P TT (Expr TT)

-- | Parses both empty and non-empty arrays. Should probably be split up
--   into further parts to allow for the separation of <tt>[]</tt> and
--   <tt>[1, 2, 3]</tt>.
array :: P TT (Expr TT)

-- | Parses a semicolon if it's there.
semicolon :: P TT (Maybe TT)

-- | Parses a comma-separated list of valid identifiers.
parameters :: P TT (Parameters TT)
parExpr :: P TT (ParExpr TT)

-- | Parses a comment.
comment :: P TT TT

-- | Parses a prefix operator.
preOp :: P TT TT

-- | Parses a infix operator.
inOp :: P TT TT

-- | Parses a postfix operator.
postOp :: P TT TT

-- | Parses any literal.
opTok :: P TT TT

-- | Parses any literal.
simpleTok :: P TT TT

-- | Parses any string.
strTok :: P TT TT

-- | Parses any valid number.
numTok :: P TT TT

-- | Parses any valid identifier.
name :: P TT TT

-- | Parses any boolean.
boolean :: P TT TT

-- | Parses a reserved word.
res :: Reserved -> P TT TT

-- | Parses a special token.
spc :: Char -> P TT TT

-- | Parses an operator.
oper :: Operator -> P TT TT

-- | Expects a token x, recovers with <a>errorToken</a>.
plzTok :: P TT TT -> P TT TT

-- | Expects a special token.
plzSpc :: Char -> P TT TT

-- | Expects an expression.
plzExpr :: P TT (Expr TT)
plz :: Failable f => P TT (f TT) -> P TT (f TT)

-- | General recovery parser, inserts an error token.
anything :: P s TT

-- | Weighted recovery.
hate :: Int -> P s a -> P s a
fromBlock :: Block t -> [Statement t]
firstTok :: Foldable f => f t -> t
errorToken :: TT
isError :: TT -> Bool

-- | Better name for <a>tokFromT</a>.
toTT :: t -> Tok t

-- | Better name for <a>tokT</a>.
fromTT :: Tok t -> t
instance Strokable (Array TT)
instance Strokable (Tok Token)
instance Strokable (KeyValue TT)
instance Strokable (ParExpr TT)
instance Strokable (Parameters TT)
instance Strokable (Expr TT)
instance Strokable (VarDecAss TT)
instance Strokable (Block TT)
instance Strokable (ForContent TT)
instance Strokable (Statement TT)
instance Failable KeyValue
instance Failable Expr
instance Failable ParExpr
instance Failable Parameters
instance Failable VarDecAss
instance Failable Block
instance Failable ForContent
instance IsTree Statement
instance Foldable KeyValue
instance Foldable Array
instance Foldable Expr
instance Foldable VarDecAss
instance Foldable Block
instance Foldable ForContent
instance Foldable ParExpr
instance Foldable Parameters
instance Foldable Statement
instance Typeable1 Parameters
instance Typeable1 KeyValue
instance Typeable1 Expr
instance Typeable1 Array
instance Typeable1 Block
instance Typeable1 Statement
instance Typeable1 VarDecAss
instance Typeable1 ForContent
instance Typeable1 ParExpr
instance Show t => Show (Parameters t)
instance Data t => Data (Parameters t)
instance Show t => Show (KeyValue t)
instance Data t => Data (KeyValue t)
instance Show t => Show (Expr t)
instance Data t => Data (Expr t)
instance Show t => Show (Array t)
instance Data t => Data (Array t)
instance Show t => Show (Block t)
instance Data t => Data (Block t)
instance Show t => Show (Statement t)
instance Data t => Data (Statement t)
instance Show t => Show (VarDecAss t)
instance Data t => Data (VarDecAss t)
instance Show t => Show (ForContent t)
instance Data t => Data (ForContent t)
instance Show t => Show (ParExpr t)
instance Data t => Data (ParExpr t)

module Yi.Verifier.JavaScript
data Error
MultipleFunctionDeclaration :: String -> [Posn] -> Error
data Warning
UnreachableCode :: Posn -> Warning
data Report
Err :: Error -> Report
Warn :: Warning -> Report

-- | The main verifier which calls the sub-verifiers.
verify :: Tree TT -> Writer (DList Report) ()

-- | Given a list of function declarations, checks for multiple function
--   declarations, including the functions' subfunctions.
checkMultipleFuns :: [Statement TT] -> Writer (DList Report) ()
checkUnreachable :: [Statement TT] -> Writer (DList Report) ()

-- | Given two <tt>Tok t</tt>, compares the <tt>t</tt>s.
ttEq :: Eq t => Tok t -> Tok t -> Bool
say :: MonadWriter (DList a) m => a -> m ()
isReturn :: Statement t -> Bool

-- | Returns a list of the functions in the given block.
findFunctions :: [Statement t] -> [Statement t]

-- | Given a <a>FunDecl</a>, returns the token representing the name.
funName :: Statement t -> t

-- | Given a <a>FunDecl</a>, returns its inner body as a list.
funBody :: Statement t -> [Statement t]

-- | Given a <tt>ValidName</tt> returns the string representing the name.
nameOf :: Token -> String

-- | Like <a>dropWhile</a> but drops the first element in the result.
dropWhile' :: (a -> Bool) -> [a] -> [a]
dupsBy :: (a -> a -> Bool) -> [a] -> [a]
instance Eq Error
instance Eq Warning
instance Eq Report
instance Show Report
instance Show Warning
instance Show Error


-- | An implementation of restricted, linear undo, as described in:
--   
--   <pre>
--   T. Berlage, "A selective undo mechanism for graphical user interfaces
--   based on command objects", ACM Transactions on Computer-Human
--   Interaction 1(3), pp. 269-294, 1994.
--   </pre>
--   
--   Implementation based on a proposal by sjw.
--   
--   From Berlage:
--   
--   <pre>
--   All buffer-mutating commands are stored (in abstract form) in an
--   Undo list. The most recent item in this list is the action that
--   will be undone next. When it is undone, it is removed from the Undo
--   list, and its inverse is added to the Redo list. The last command
--   put into the Redo list can be redone, and again prepended to the
--   Undo list. New commands are added to the Undo list without
--   affecting the Redo list.
--   </pre>
--   
--   Now, the above assumes that commands can be _redone_ in a state other
--   than that in which it was orginally done. This is not the case in our
--   text editor: a user may delete, for example, between an undo and a
--   redo. Berlage addresses this in S2.3. A Yi example:
--   
--   <pre>
--   Delete some characters
--   Undo partialy
--   Move prior in the file, and delete another _chunk_
--   Redo some things  == corruption.
--   </pre>
--   
--   Berlage describes the <i>stable execution property</i>:
--   
--   <pre>
--   A command is always redone in the same state that it was originally
--   executed in, and is always undone in the state that was reached
--   after the original execution.
--   </pre>
--   
--   <pre>
--   The only case where the linear undo model violates the stable
--   execution property is when _a new command is submitted while the
--   redo list is not empty_. The _restricted linear undo model_ ...
--   clears the redo list in this case.
--   </pre>
--   
--   Also some discussion of this in: <i>The Text Editor Sam</i>, Rob Pike,
--   pg 19.
module Yi.Buffer.Undo

-- | A new empty <a>URList</a>. Notice we must have a saved file point as
--   this is when we assume we are opening the file so it is currently the
--   same as the one on disk
emptyU :: URList

-- | Add an action to the undo list. According to the restricted, linear
--   undo model, if we add a command whilst the redo list is not empty, we
--   will lose our redoable changes.
addChangeU :: Change -> URList -> URList

-- | Add a saved file point so that we can tell that the buffer has not
--   been modified since the previous saved file point. Notice that we must
--   be sure to remove the previous saved file points since they are now
--   worthless.
setSavedFilePointU :: URList -> URList

-- | undoIsAtSavedFilePoint. <tt>True</tt> if the undo list is at a
--   SavedFilePoint indicating that the buffer has not been modified since
--   we last saved the file. Note: that an empty undo list does NOT mean
--   that the buffer is not modified since the last save. Because we may
--   have saved the file and then undone actions done before the save.
isAtSavedFilePointU :: URList -> Bool

-- | This undoes one interaction step.
undoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, [Update]))

-- | This redoes one iteraction step.
redoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, [Update]))

-- | A URList consists of an undo and a redo list.
data URList
data Change
InteractivePoint :: Change
AtomicChange :: !Update -> Change
instance Binary URList
instance Show URList
instance Binary Change
instance Show Change


-- | The <tt>Buffer</tt> module defines monadic editing operations over
--   one-dimensional buffers, maintaining a current <i>point</i>.
module Yi.Buffer.Misc
data FBuffer
FBuffer :: !(Mode syntax) -> !(BufferImpl syntax) -> !Attributes -> FBuffer

-- | The BufferM monad writes the updates performed.
newtype BufferM a
BufferM :: RWS Window [Update] FBuffer a -> BufferM a
fromBufferM :: BufferM a -> RWS Window [Update] FBuffer a
type WinMarks = MarkSet Mark
data MarkSet a
MarkSet :: !a -> !a -> !a -> MarkSet a
fromMark :: MarkSet a -> !a
insMark :: MarkSet a -> !a
selMark :: MarkSet a -> !a
bkey :: FBuffer -> BufferRef
getMarks :: Window -> BufferM (Maybe WinMarks)

-- | Execute a <tt>BufferM</tt> value on a given buffer and window. The new
--   state of the buffer is returned alongside the result of the
--   computation.
runBuffer :: Window -> FBuffer -> BufferM a -> (a, FBuffer)
runBufferFull :: Window -> FBuffer -> BufferM a -> (a, [Update], FBuffer)

-- | Execute a <tt>BufferM</tt> value on a given buffer, using a dummy
--   window. The new state of the buffer is discarded.
runBufferDummyWindow :: FBuffer -> BufferM a -> a

-- | Return the current line number
curLn :: BufferM Int

-- | Current column. Note that this is different from offset or number of
--   chars from sol. (This takes into account tabs, unicode chars, etc.)
curCol :: BufferM Int
colOf :: Point -> BufferM Int
lineOf :: Point -> BufferM Int
lineCountB :: BufferM Int

-- | Point of eof
sizeB :: BufferM Point

-- | Extract the current point
pointB :: BufferM Point
pointOfLineColB :: Int -> Int -> BufferM Point
solPointB :: BufferM Point

-- | Return line numbers of marks
markLines :: BufferM (MarkSet Int)

-- | Move point in buffer to the given index
moveTo :: Point -> BufferM ()
moveToColB :: Int -> BufferM ()
moveToLineColB :: Int -> Int -> BufferM ()

-- | Move point down by <tt>n</tt> lines. <tt>n</tt> can be negative.
--   Returns the actual difference in lines which we moved which may be
--   negative if the requested line difference is negative.
lineMoveRel :: Int -> BufferM Int

-- | Move point up one line
lineUp :: BufferM ()

-- | Move point down one line
lineDown :: BufferM ()

-- | Create buffer named <tt>nm</tt> with contents <tt>s</tt>
newB :: BufferRef -> BufferId -> Rope -> FBuffer
data MarkValue
MarkValue :: !Point -> !Direction -> MarkValue
markPoint :: MarkValue -> !Point
markGravity :: MarkValue -> !Direction
data Overlay
data OvlLayer
UserLayer :: OvlLayer
HintLayer :: OvlLayer

-- | Create an <a>overlay</a> for the style <tt>sty</tt> between points
--   <tt>s</tt> and <tt>e</tt>
mkOverlay :: OvlLayer -> Region -> StyleName -> Overlay

-- | Go to line number <tt>n</tt>. <tt>n</tt> is indexed from 1. Returns
--   the actual line we went to (which may be not be the requested line, if
--   it was out of range)
gotoLn :: Int -> BufferM Int

-- | Go to line indexed from current point Returns the actual moved
--   difference which of course may be negative if the requested difference
--   was negative.
gotoLnFrom :: Int -> BufferM Int

-- | Move point -1
leftB :: BufferM ()

-- | Move cursor +1
rightB :: BufferM ()

-- | Move point by the given number of characters. A negative offset moves
--   backwards a positive one forward.
moveN :: Int -> BufferM ()

-- | Move cursor -n
leftN :: Int -> BufferM ()

-- | Move cursor +n
rightN :: Int -> BufferM ()
insertN' :: Rope -> BufferM ()

-- | Insert the list at current point, extending size of buffer
insertN :: String -> BufferM ()
insertNAt' :: Rope -> Point -> BufferM ()

-- | Insert the list at specified point, extending size of buffer
insertNAt :: String -> Point -> BufferM ()

-- | Insert the char at current point, extending size of buffer
insertB :: Char -> BufferM ()

-- | Delete <tt>n</tt> characters forward from the current point
deleteN :: Int -> BufferM ()

-- | Return <tt>n</tt> elems starting at <tt>i</tt> of the buffer as a list
nelemsB :: Int -> Point -> BufferM String
nelemsB' :: Int -> Point -> BufferM Rope

-- | Write an element into the buffer at the current point.
writeB :: Char -> BufferM ()

-- | Write the list into the buffer at current point.
writeN :: String -> BufferM ()

-- | Insert newline at current point.
newlineB :: BufferM ()

-- | <tt>deleteNAt n p</tt> deletes <tt>n</tt> characters forwards from
--   position <tt>p</tt>
deleteNAt :: Direction -> Int -> Point -> BufferM ()

-- | Read the character at the current point
readB :: BufferM Char

-- | Return the contents of the buffer as a list
elemsB :: BufferM String
undosA :: Accessor FBuffer URList
undoB :: BufferM ()
redoB :: BufferM ()
getMarkB :: Maybe String -> BufferM Mark
setMarkHereB :: BufferM Mark
setNamedMarkHereB :: String -> BufferM ()
mayGetMarkB :: String -> BufferM (Maybe Mark)
getMarkValueB :: Mark -> BufferM MarkValue

-- | Set the given mark's point.
setMarkPointB :: Mark -> Point -> BufferM ()
modifyMarkB :: Mark -> (MarkValue -> MarkValue) -> BufferM ()
newMarkB :: MarkValue -> BufferM Mark
deleteMarkB :: Mark -> BufferM ()

-- | Highlight the selection
setVisibleSelection :: Bool -> BufferM ()
isUnchangedBuffer :: FBuffer -> Bool

-- | Set the mode
setAnyMode :: AnyMode -> BufferM ()
setMode :: Mode syntax -> BufferM ()
setMode0 :: Mode syntax -> FBuffer -> FBuffer

-- | Modify the mode
modifyMode :: (forall syntax. Mode syntax -> Mode syntax) -> BufferM ()

-- | Return indices of strings in buffer matched by regex in the given
--   region.
regexRegionB :: SearchExp -> Region -> BufferM [Region]

-- | Return indices of next string in buffer matched by regex in the given
--   direction
regexB :: Direction -> SearchExp -> BufferM [Region]

-- | Read the character at the given index This is an unsafe operation:
--   character NUL is returned when out of bounds
readAtB :: Point -> BufferM Char

-- | Given a buffer, and some information update the modeline
--   
--   N.B. the contents of modelines should be specified by user, and not
--   hardcoded.
getModeLine :: [String] -> BufferM String

-- | Given a point, and the file size, gives us a percent string
getPercent :: Point -> Point -> String
setInserting :: Bool -> BufferM ()
savingPrefCol :: BufferM a -> BufferM a
forgetPreferCol :: BufferM ()
movingToPrefCol :: BufferM a -> BufferM a
getPrefCol :: BufferM (Maybe Int)
setPrefCol :: Maybe Int -> BufferM ()

-- | Mark the current point in the undo list as a saved state.
markSavedB :: UTCTime -> BufferM ()

-- | Adds an <a>overlay</a> to the buffer
addOverlayB :: Overlay -> BufferM ()

-- | Remove an existing <a>overlay</a>
delOverlayB :: Overlay -> BufferM ()
delOverlayLayerB :: OvlLayer -> BufferM ()

-- | perform a <tt>BufferM a</tt>, and return to the current point. (by
--   using a mark)
savingExcursionB :: BufferM a -> BufferM a

-- | perform an <tt>BufferM a</tt>, and return to the current point
savingPointB :: BufferM a -> BufferM a
pendingUpdatesA :: Accessor FBuffer [UIUpdate]
highlightSelectionA :: Accessor FBuffer Bool
rectangleSelectionA :: Accessor FBuffer Bool
readOnlyA :: Accessor FBuffer Bool
insertingA :: Accessor FBuffer Bool
pointFollowsWindowA :: Accessor FBuffer (WindowRef -> Bool)

-- | Revert all the pending updates; don't touch the point.
revertPendingUpdatesB :: BufferM ()
askWindow :: (Window -> a) -> BufferM a

-- | udpate the syntax information (clear the dirty <a>flag</a>)
clearSyntax :: FBuffer -> FBuffer
focusSyntax :: Map WindowRef Region -> FBuffer -> FBuffer

-- | A Mode customizes the Yi interface for editing a particular data
--   format. It specifies when the mode should be used and controls
--   file-specific syntax highlighting and command input, among other
--   things.
data Mode syntax
Mode :: String -> (FilePath -> String -> Bool) -> ExtHL syntax -> (syntax -> BufferM ()) -> (KeymapSet -> KeymapSet) -> (syntax -> IndentBehaviour -> BufferM ()) -> (syntax -> Int -> BufferM ()) -> (syntax -> Action) -> IndentSettings -> BufferM () -> (syntax -> Point -> Point -> Point -> [Stroke]) -> (syntax -> Point -> [Span String]) -> (syntax -> BufferM ()) -> BufferM () -> ([String] -> BufferM String) -> Mode syntax

-- | so this can be serialized, debugged.
modeName :: Mode syntax -> String

-- | What type of files does this mode apply to?
modeApplies :: Mode syntax -> FilePath -> String -> Bool

-- | Syntax highlighter
modeHL :: Mode syntax -> ExtHL syntax

-- | Prettify current "paragraph"
modePrettify :: Mode syntax -> syntax -> BufferM ()

-- | Buffer-local keymap modification
modeKeymap :: Mode syntax -> KeymapSet -> KeymapSet

-- | emacs-style auto-indent line
modeIndent :: Mode syntax -> syntax -> IndentBehaviour -> BufferM ()

-- | adjust the indentation after modification
modeAdjustBlock :: Mode syntax -> syntax -> Int -> BufferM ()

-- | Follow a "link" in the file. (eg. go to location of error message)
modeFollow :: Mode syntax -> syntax -> Action
modeIndentSettings :: Mode syntax -> IndentSettings
modeToggleCommentSelection :: Mode syntax -> BufferM ()

-- | Strokes that should be applied when displaying a syntax element
modeGetStrokes :: Mode syntax -> syntax -> Point -> Point -> Point -> [Stroke]
modeGetAnnotations :: Mode syntax -> syntax -> Point -> [Span String]
modePrintTree :: Mode syntax -> syntax -> BufferM ()

-- | An action that is to be executed when this mode is set
modeOnLoad :: Mode syntax -> BufferM ()

-- | buffer-local modeline formatting method
modeModeLine :: Mode syntax -> [String] -> BufferM String
modeNameA :: T (Mode syntax_a3LOX) String
modeAppliesA :: T (Mode syntax_a3LOX) (FilePath -> String -> Bool)
modeHLA :: T (Mode syntax_a3LOX) (ExtHL syntax_a3LOX)
modePrettifyA :: T (Mode syntax_a3LOX) (syntax_a3LOX -> BufferM ())
modeKeymapA :: T (Mode syntax_a3LOX) (KeymapSet -> KeymapSet)
modeIndentA :: T (Mode syntax_a3LOX) (syntax_a3LOX -> IndentBehaviour -> BufferM ())
modeAdjustBlockA :: T (Mode syntax_a3LOX) (syntax_a3LOX -> Int -> BufferM ())
modeFollowA :: T (Mode syntax_a3LOX) (syntax_a3LOX -> Action)
modeIndentSettingsA :: T (Mode syntax_a3LOX) IndentSettings
modeToggleCommentSelectionA :: T (Mode syntax_a3LOX) (BufferM ())
modeGetStrokesA :: T (Mode syntax_a3LOX) (syntax_a3LOX -> Point -> Point -> Point -> [Stroke])
modeGetAnnotationsA :: T (Mode syntax_a3LOX) (syntax_a3LOX -> Point -> [Span String])
modePrintTreeA :: T (Mode syntax_a3LOX) (syntax_a3LOX -> BufferM ())
modeOnLoadA :: T (Mode syntax_a3LOX) (BufferM ())
modeModeLineA :: T (Mode syntax_a3LOX) ([String] -> BufferM String)
data AnyMode
AnyMode :: (Mode syntax) -> AnyMode

-- | Used to specify the behaviour of the automatic indent command.
data IndentBehaviour

-- | Increase the indentation to the next higher indentation hint. If we
--   are currently at the highest level of indentation then cycle back to
--   the lowest.
IncreaseCycle :: IndentBehaviour

-- | Decrease the indentation to the next smaller indentation hint. If we
--   are currently at the smallest level then cycle back to the largest
DecreaseCycle :: IndentBehaviour

-- | Increase the indentation to the next higher hint if no such hint
--   exists do nothing.
IncreaseOnly :: IndentBehaviour

-- | Decrease the indentation to the next smaller indentation hint, if no
--   such hint exists do nothing.
DecreaseOnly :: IndentBehaviour

-- | Currently duplicates some of Vim's indent settings. Allowing a buffer
--   to - specify settings that are more dynamic, perhaps via closures,
--   could be - useful.
data IndentSettings
IndentSettings :: Bool -> Int -> Int -> IndentSettings

-- | Insert spaces instead of tabs as possible
expandTabs :: IndentSettings -> Bool

-- | Size of a Tab
tabSize :: IndentSettings -> Int

-- | Indent by so many columns
shiftWidth :: IndentSettings -> Int

-- | Mode applies function that always returns True.
modeAlwaysApplies :: FilePath -> String -> Bool

-- | Mode applies function that always returns False.
modeNeverApplies :: FilePath -> String -> Bool
emptyMode :: Mode syntax
withModeB :: (forall syntax. Mode syntax -> BufferM a) -> BufferM a
withMode0 :: (forall syntax. Mode syntax -> a) -> FBuffer -> a
onMode :: (forall syntax. Mode syntax -> Mode syntax) -> AnyMode -> AnyMode
withSyntaxB :: (forall syntax. Mode syntax -> syntax -> a) -> BufferM a
withSyntaxB' :: (forall syntax. Mode syntax -> syntax -> BufferM a) -> BufferM a
keymapProcessA :: Accessor FBuffer KeymapProcess
strokesRangesB :: Maybe SearchExp -> Region -> BufferM [[Stroke]]
streamB :: Direction -> Point -> BufferM Rope
indexedStreamB :: Direction -> Point -> BufferM [(Point, Char)]
getMarkPointB :: Mark -> BufferM Point
askMarks :: BufferM WinMarks
pointAt :: BufferM a -> BufferM Point
data SearchExp

-- | Use in readonly!
lastActiveWindowA :: Accessor FBuffer Window

-- | Access to a value into the extensible state, keyed by its type. This
--   allows you to save or retrieve inside a <a>BufferM</a> monad, ie:
--   
--   <pre>
--   putA bufferDynamicValueA updatedvalue
--   value &lt;- getA bufferDynamicValueA
--   </pre>
bufferDynamicValueA :: YiVariable a => Accessor FBuffer a
shortIdentString :: [a] -> FBuffer -> [Char]
identString :: FBuffer -> [Char]
miniIdentString :: FBuffer -> [Char]
identA :: Accessor FBuffer BufferId

-- | maybe a filename associated with this buffer. Filename is
--   canonicalized.
type BufferId = Either String FilePath
file :: FBuffer -> (Maybe FilePath)
lastSyncTimeA :: Accessor FBuffer UTCTime
replaceCharB :: Char -> BufferM ()
replaceCharWithBelowB :: BufferM ()
replaceCharWithAboveB :: BufferM ()
insertCharWithBelowB :: BufferM ()
insertCharWithAboveB :: BufferM ()
pointAfterCursorB :: Point -> BufferM Point

-- | What would be the point after doing the given action? The argument
--   must not modify the buffer.
destinationOfMoveB :: BufferM a -> BufferM Point
withEveryLineB :: BufferM () -> BufferM ()
startUpdateTransactionB :: BufferM ()
commitUpdateTransactionB :: BufferM ()
instance Typeable IndentSettings
instance Typeable1 BufferM
instance Typeable FBuffer
instance Typeable AnyMode
instance Eq IndentSettings
instance Show IndentSettings
instance Eq IndentBehaviour
instance Show IndentBehaviour
instance Monad BufferM
instance Functor BufferM
instance MonadWriter [Update] BufferM
instance MonadState FBuffer BufferM
instance MonadReader Window BufferM
instance Show FBuffer
instance Eq FBuffer
instance Applicative BufferM
instance Binary (Mode syntax)
instance Binary SelectionStyle
instance Binary FBuffer
instance Binary UTCTime
instance Binary Attributes
instance Typeable SelectionStyle
instance Typeable Attributes
instance Binary a_1628288328 => Binary (MarkSet a_1628288328)
instance Functor MarkSet
instance Foldable MarkSet
instance Traversable MarkSet


-- | This module defines buffer operation on regions
module Yi.Buffer.Region

-- | Swap the content of two Regions
swapRegionsB :: Region -> Region -> BufferM ()

-- | Delete an arbitrary part of the buffer
deleteRegionB :: Region -> BufferM ()

-- | Replace a region with a given string.
replaceRegionB :: Region -> String -> BufferM ()

-- | Replace a region with a given rope.
replaceRegionB' :: Region -> Rope -> BufferM ()

-- | As <a>replaceRegionB</a>, but do a minimal edition instead of deleting
--   the whole region and inserting it back.
replaceRegionClever :: Region -> String -> BufferM ()

-- | Read an arbitrary part of the buffer
readRegionB :: Region -> BufferM String
readRegionB' :: Region -> BufferM Rope
mapRegionB :: Region -> (Char -> Char) -> BufferM ()

-- | Modifies the given region according to the given string transformation
--   function
modifyRegionB :: (String -> String) -> Region -> BufferM ()

-- | As <a>modifyRegionB</a>, but do a minimal edition instead of deleting
--   the whole region and inserting it back.
modifyRegionClever :: (String -> String) -> Region -> BufferM ()
winRegionB :: BufferM Region

-- | Extend the right bound of a region to include it.
inclusiveRegionB :: Region -> BufferM Region

-- | See a region as a block/rectangular region, since regions are
--   represented by two point, this returns a list of small regions form
--   this block region.
blockifyRegion :: Region -> BufferM [Region]
joinLinesB :: Region -> BufferM ()
concatLinesB :: Region -> BufferM ()

module Yi.Buffer.TextUnit

-- | Designate a given <a>unit</a> of text.
data TextUnit

-- | a single character
Character :: TextUnit

-- | a line of text (between newlines)
Line :: TextUnit

-- | a <a>vertical</a> line of text (area of text between two characters at
--   the same column number)
VLine :: TextUnit

-- | the whole document
Document :: TextUnit
GenUnit :: TextUnit -> (Direction -> BufferM Bool) -> TextUnit
genEnclosingUnit :: TextUnit -> TextUnit
genUnitBoundary :: TextUnit -> Direction -> BufferM Bool

-- | Turns a unit into its <a>negative</a> by inverting the boundaries. For
--   example, <tt>outsideUnit unitViWord</tt> will be the unit of spaces
--   between words. For units without boundaries (<a>Character</a>,
--   <a>Document</a>, ...), this is the identity function.
outsideUnit :: TextUnit -> TextUnit

-- | Unit that have its left and right boundaries at the left boundary of
--   the argument unit.
leftBoundaryUnit :: TextUnit -> TextUnit

-- | delimited on the left and right by given characters, boolean argument
--   tells if whether those are included.
--   
--   a word as in use in Emacs (fundamental mode)
unitWord :: TextUnit
unitViWord :: TextUnit
unitViWORD :: TextUnit
unitViWordAnyBnd :: TextUnit
unitViWORDAnyBnd :: TextUnit
unitViWordOnLine :: TextUnit
unitViWORDOnLine :: TextUnit
unitDelimited :: Char -> Char -> Bool -> TextUnit
unitSentence :: TextUnit

-- | Paragraph to implement emacs-like forward-paragraph/backward-paragraph
unitEmacsParagraph :: TextUnit

-- | Paragraph that begins and ends in the paragraph, not the empty lines
--   surrounding it.
unitParagraph :: TextUnit

-- | Separator characters (space, tab, unicode separators). Most of the
--   units above attempt to identify <a>words</a> with various punctuation
--   and symbols included or excluded. This set of units is a simple
--   inverse: it is true for <a>whitespace</a> or <a>separators</a> and
--   false for anything that is not (letters, numbers, symbols,
--   punctuation, whatever).
isAnySep :: Char -> Bool

-- | unitSep is true for any kind of whitespace/separator
unitSep :: TextUnit

-- | unitSepThisLine is true for any kind of whitespace/separator on this
--   line only
unitSepThisLine :: TextUnit
isWordChar :: Char -> Bool

-- | Move to the next unit boundary
moveB :: TextUnit -> Direction -> BufferM ()

-- | As <a>moveB</a>, unless the point is at a unit boundary
maybeMoveB :: TextUnit -> Direction -> BufferM ()
transformB :: (String -> String) -> TextUnit -> Direction -> BufferM ()
transposeB :: TextUnit -> Direction -> BufferM ()

-- | Region of the whole textunit where the current point is.
regionOfB :: TextUnit -> BufferM Region

-- | Non empty region of the whole textunit where the current point is.
regionOfNonEmptyB :: TextUnit -> BufferM Region

-- | Region between the point and the next boundary. The region is empty if
--   the point is at the boundary.
regionOfPartB :: TextUnit -> Direction -> BufferM Region
regionWithTwoMovesB :: BufferM a -> BufferM b -> BufferM Region

-- | Non empty region between the point and the next boundary, In fact the
--   region can be empty if we are at the end of file.
regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region

-- | Non empty region at given point and the next boundary,
regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region
readPrevUnitB :: TextUnit -> BufferM String
readUnitB :: TextUnit -> BufferM String

-- | Repeat an action until the condition is fulfilled or the cursor stops
--   moving. The Action may be performed zero times.
untilB :: BufferM Bool -> BufferM a -> BufferM [a]
doUntilB_ :: BufferM Bool -> BufferM a -> BufferM ()
untilB_ :: BufferM Bool -> BufferM a -> BufferM ()
whileB :: BufferM Bool -> BufferM a -> BufferM [a]

-- | Do an action if the current buffer character passes the predicate
doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM ()
atBoundaryB :: TextUnit -> Direction -> BufferM Bool
numberOfB :: TextUnit -> TextUnit -> BufferM Int

-- | Delete between point and next unit boundary, return the deleted
--   region.
deleteB :: TextUnit -> Direction -> BufferM ()

-- | Generic maybe move operation. As genMoveB, but don't move if we are at
--   boundary already.
genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()

-- | Generic move operation Warning: moving To the (OutsideBound, Backward)
--   bound of Document is impossible (offset -1!) <tt>genMoveB u b d</tt>:
--   move in direction d until encountering boundary b or unit u. See
--   <a>genAtBoundaryB</a> for boundary explanation.
genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()

-- | Boundary side
data BoundarySide
InsideBound :: BoundarySide
OutsideBound :: BoundarySide

-- | <tt>genAtBoundaryB u d s</tt> returns whether the point is at a given
--   boundary <tt>(d,s)</tt> . Boundary <tt>(d,s)</tt> , taking Word as
--   example, means: Word ^^ ^^ 12 34 1: (Backward,OutsideBound) 2:
--   (Backward,InsideBound) 3: (Forward,InsideBound) 4:
--   (Forward,OutsideBound)
--   
--   rules: genAtBoundaryB u Backward InsideBound = atBoundaryB u Backward
--   genAtBoundaryB u Forward OutsideBound = atBoundaryB u Forward
genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
halfUnit :: Direction -> TextUnit -> TextUnit
deleteUnitB :: TextUnit -> Direction -> BufferM ()
instance Typeable TextUnit
instance Eq BoundarySide


-- | A normalized API to many buffer operations.
module Yi.Buffer.Normal

-- | Designate a given <a>unit</a> of text.
data TextUnit

-- | a single character
Character :: TextUnit

-- | a line of text (between newlines)
Line :: TextUnit

-- | a <a>vertical</a> line of text (area of text between two characters at
--   the same column number)
VLine :: TextUnit

-- | the whole document
Document :: TextUnit
GenUnit :: TextUnit -> (Direction -> BufferM Bool) -> TextUnit
genEnclosingUnit :: TextUnit -> TextUnit
genUnitBoundary :: TextUnit -> Direction -> BufferM Bool

-- | Turns a unit into its <a>negative</a> by inverting the boundaries. For
--   example, <tt>outsideUnit unitViWord</tt> will be the unit of spaces
--   between words. For units without boundaries (<a>Character</a>,
--   <a>Document</a>, ...), this is the identity function.
outsideUnit :: TextUnit -> TextUnit

-- | Unit that have its left and right boundaries at the left boundary of
--   the argument unit.
leftBoundaryUnit :: TextUnit -> TextUnit

-- | delimited on the left and right by given characters, boolean argument
--   tells if whether those are included.
--   
--   a word as in use in Emacs (fundamental mode)
unitWord :: TextUnit
unitViWord :: TextUnit
unitViWORD :: TextUnit
unitViWordAnyBnd :: TextUnit
unitViWORDAnyBnd :: TextUnit
unitViWordOnLine :: TextUnit
unitViWORDOnLine :: TextUnit
unitDelimited :: Char -> Char -> Bool -> TextUnit
unitSentence :: TextUnit

-- | Paragraph to implement emacs-like forward-paragraph/backward-paragraph
unitEmacsParagraph :: TextUnit

-- | Paragraph that begins and ends in the paragraph, not the empty lines
--   surrounding it.
unitParagraph :: TextUnit

-- | Separator characters (space, tab, unicode separators). Most of the
--   units above attempt to identify <a>words</a> with various punctuation
--   and symbols included or excluded. This set of units is a simple
--   inverse: it is true for <a>whitespace</a> or <a>separators</a> and
--   false for anything that is not (letters, numbers, symbols,
--   punctuation, whatever).
isAnySep :: Char -> Bool

-- | unitSep is true for any kind of whitespace/separator
unitSep :: TextUnit

-- | unitSepThisLine is true for any kind of whitespace/separator on this
--   line only
unitSepThisLine :: TextUnit
isWordChar :: Char -> Bool

-- | Move to the next unit boundary
moveB :: TextUnit -> Direction -> BufferM ()

-- | As <a>moveB</a>, unless the point is at a unit boundary
maybeMoveB :: TextUnit -> Direction -> BufferM ()
transformB :: (String -> String) -> TextUnit -> Direction -> BufferM ()
transposeB :: TextUnit -> Direction -> BufferM ()

-- | Region of the whole textunit where the current point is.
regionOfB :: TextUnit -> BufferM Region

-- | Non empty region of the whole textunit where the current point is.
regionOfNonEmptyB :: TextUnit -> BufferM Region

-- | Region between the point and the next boundary. The region is empty if
--   the point is at the boundary.
regionOfPartB :: TextUnit -> Direction -> BufferM Region

-- | Non empty region between the point and the next boundary, In fact the
--   region can be empty if we are at the end of file.
regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region

-- | Non empty region at given point and the next boundary,
regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region
readPrevUnitB :: TextUnit -> BufferM String
readUnitB :: TextUnit -> BufferM String

-- | Repeat an action until the condition is fulfilled or the cursor stops
--   moving. The Action may be performed zero times.
untilB :: BufferM Bool -> BufferM a -> BufferM [a]
doUntilB_ :: BufferM Bool -> BufferM a -> BufferM ()
untilB_ :: BufferM Bool -> BufferM a -> BufferM ()
whileB :: BufferM Bool -> BufferM a -> BufferM [a]

-- | Do an action if the current buffer character passes the predicate
doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM ()
atBoundaryB :: TextUnit -> Direction -> BufferM Bool
numberOfB :: TextUnit -> TextUnit -> BufferM Int

-- | Delete between point and next unit boundary, return the deleted
--   region.
deleteB :: TextUnit -> Direction -> BufferM ()

-- | Generic maybe move operation. As genMoveB, but don't move if we are at
--   boundary already.
genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()

-- | Generic move operation Warning: moving To the (OutsideBound, Backward)
--   bound of Document is impossible (offset -1!) <tt>genMoveB u b d</tt>:
--   move in direction d until encountering boundary b or unit u. See
--   <a>genAtBoundaryB</a> for boundary explanation.
genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()

-- | Boundary side
data BoundarySide
InsideBound :: BoundarySide
OutsideBound :: BoundarySide

-- | <tt>genAtBoundaryB u d s</tt> returns whether the point is at a given
--   boundary <tt>(d,s)</tt> . Boundary <tt>(d,s)</tt> , taking Word as
--   example, means: Word ^^ ^^ 12 34 1: (Backward,OutsideBound) 2:
--   (Backward,InsideBound) 3: (Forward,InsideBound) 4:
--   (Forward,OutsideBound)
--   
--   rules: genAtBoundaryB u Backward InsideBound = atBoundaryB u Backward
--   genAtBoundaryB u Forward OutsideBound = atBoundaryB u Forward
genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
data RegionStyle
LineWise :: RegionStyle
Inclusive :: RegionStyle
Exclusive :: RegionStyle
Block :: RegionStyle
mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region
convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region
unitWiseRegion :: TextUnit -> Region -> BufferM Region

-- | Extend the given region to boundaries of the text unit. For instance
--   one can extend the selection to complete lines, or paragraphs.
extendRegionToBoundaries :: TextUnit -> BoundarySide -> BoundarySide -> Region -> BufferM Region
regionStyleA :: Accessor FBuffer RegionStyle
instance YiVariable RegionStyle
instance Initializable RegionStyle
instance Binary RegionStyle
instance Typeable RegionStyle
instance Eq RegionStyle
instance Show RegionStyle

module Yi.Buffer.HighLevel

-- | Move point to start of line
moveToSol :: BufferM ()

-- | Move point to end of line
moveToEol :: BufferM ()

-- | Move cursor to origin
topB :: BufferM ()

-- | Move cursor to end of buffer
botB :: BufferM ()

-- | Move left if on eol, but not on blank line
leftOnEol :: BufferM ()

-- | Move <tt>x</tt> chars back, or to the sol, whichever is less
moveXorSol :: Int -> BufferM ()

-- | Move <tt>x</tt> chars forward, or to the eol, whichever is less
moveXorEol :: Int -> BufferM ()

-- | Move to first char of next word forwards
nextWordB :: BufferM ()

-- | Move to first char of next word backwards
prevWordB :: BufferM ()
gotoCharacterB :: Char -> Direction -> RegionStyle -> Bool -> BufferM ()

-- | Move to the next occurence of <tt>c</tt>
nextCInc :: Char -> BufferM ()
nextCInLineInc :: Char -> BufferM ()

-- | Move to the character before the next occurence of <tt>c</tt>
nextCExc :: Char -> BufferM ()
nextCInLineExc :: Char -> BufferM ()

-- | Move to the previous occurence of <tt>c</tt>
prevCInc :: Char -> BufferM ()
prevCInLineInc :: Char -> BufferM ()

-- | Move to the character after the previous occurence of <tt>c</tt>
prevCExc :: Char -> BufferM ()
prevCInLineExc :: Char -> BufferM ()

-- | Move to first non-space character in this line
firstNonSpaceB :: BufferM ()

-- | Move to the last non-space character in this line
lastNonSpaceB :: BufferM ()

-- | Go to the first non space character in the line; if already there,
--   then go to the beginning of the line.
moveNonspaceOrSol :: BufferM ()

-- | True if current line consists of just a newline (no whitespace)
isCurrentLineEmptyB :: BufferM Bool

-- | Note: Returns False if line doesn't have any characters besides a
--   newline
isCurrentLineAllWhiteSpaceB :: BufferM Bool

-- | Move down next <tt>n</tt> paragraphs
nextNParagraphs :: Int -> BufferM ()

-- | Move up prev <tt>n</tt> paragraphs
prevNParagraphs :: Int -> BufferM ()
goUnmatchedB :: Direction -> Char -> Char -> BufferM ()

-- | Return true if the current point is the start of a line
atSol :: BufferM Bool

-- | Return true if the current point is the end of a line
atEol :: BufferM Bool

-- | True if point at start of file
atSof :: BufferM Bool

-- | True if point at end of file
atEof :: BufferM Bool

-- | True if point at the last line
atLastLine :: BufferM Bool

-- | Get the current line and column number
getLineAndCol :: BufferM (Int, Int)
getLineAndColOfPoint :: Point -> BufferM (Int, Int)

-- | Read the line the point is on
readLnB :: BufferM String
readCharB :: BufferM (Maybe Char)

-- | Read from point to end of line
readRestOfLnB :: BufferM String

-- | Read from point to beginning of line
readPreviousOfLnB :: BufferM String
hasWhiteSpaceBefore :: BufferM Bool

-- | Get the previous point, unless at the beginning of the file
prevPointB :: BufferM Point

-- | Get the next point, unless at the end of the file
nextPointB :: BufferM Point
readCurrentWordB :: BufferM String
readPrevWordB :: BufferM String

-- | Delete one character backward
bdeleteB :: BufferM ()

-- | Delete forward whitespace or non-whitespace depending on the character
--   under point.
killWordB :: BufferM ()

-- | Delete backward whitespace or non-whitespace depending on the
--   character before point.
bkillWordB :: BufferM ()

-- | capitalise the word under the cursor
uppercaseWordB :: BufferM ()

-- | lowerise word under the cursor
lowercaseWordB :: BufferM ()

-- | capitalise the first letter of this word
capitaliseWordB :: BufferM ()

-- | switch the case of the letter under the cursor
switchCaseCharB :: BufferM ()
switchCaseChar :: Char -> Char

-- | Delete to the end of line, excluding it.
deleteToEol :: BufferM ()

-- | Delete whole line moving to the next line
deleteLineForward :: BufferM ()

-- | Transpose two characters, (the Emacs C-t action)
swapB :: BufferM ()

-- | Delete trailing whitespace from all lines
deleteTrailingSpaceB :: BufferM ()

-- | Marks
--   
--   Set the current buffer selection mark
setSelectionMarkPointB :: Point -> BufferM ()

-- | Get the current buffer selection mark
getSelectionMarkPointB :: BufferM Point

-- | Exchange point &amp; mark.
exchangePointAndMarkB :: BufferM ()
getBookmarkB :: String -> BufferM Mark
data BufferFileInfo
BufferFileInfo :: FilePath -> Int -> Int -> Int -> Point -> String -> Bool -> BufferFileInfo
bufInfoFileName :: BufferFileInfo -> FilePath
bufInfoSize :: BufferFileInfo -> Int
bufInfoLineNo :: BufferFileInfo -> Int
bufInfoColNo :: BufferFileInfo -> Int
bufInfoCharNo :: BufferFileInfo -> Point
bufInfoPercent :: BufferFileInfo -> String
bufInfoModified :: BufferFileInfo -> Bool

-- | File info, size in chars, line no, col num, char num, percent
bufInfoB :: BufferM BufferFileInfo
upScreensB :: Int -> BufferM ()
downScreensB :: Int -> BufferM ()

-- | Scroll up 1 screen
upScreenB :: BufferM ()

-- | Scroll down 1 screen
downScreenB :: BufferM ()

-- | Scroll by n screens (negative for up)
scrollScreensB :: Int -> BufferM ()

-- | Scroll according to function passed. The function takes the | Window
--   height in lines, its result is passed to scrollB | (negative for up)
scrollByB :: (Int -> Int) -> Int -> BufferM ()

-- | Same as scrollB, but also moves the cursor
vimScrollB :: Int -> BufferM ()

-- | Same as scrollByB, but also moves the cursor
vimScrollByB :: (Int -> Int) -> Int -> BufferM ()

-- | Move to middle line in screen
scrollToCursorB :: BufferM ()

-- | Move cursor to the top of the screen
scrollCursorToTopB :: BufferM ()

-- | Move cursor to the bottom of the screen
scrollCursorToBottomB :: BufferM ()

-- | Scroll by n lines.
scrollB :: Int -> BufferM ()

-- | Move the point to inside the viewable region
snapInsB :: BufferM ()

-- | return index of Sol on line <tt>n</tt> above current line
indexOfSolAbove :: Int -> BufferM Point
data RelPosition
Above :: RelPosition
Below :: RelPosition
Within :: RelPosition

-- | return relative position of the point <tt>p</tt> relative to the
--   region defined by the points <tt>rs</tt> and <tt>re</tt>
pointScreenRelPosition :: Point -> Point -> Point -> RelPosition

-- | Move the visible region to include the point
snapScreenB :: Maybe ScrollStyle -> BufferM Bool

-- | Move to <tt>n</tt> lines down from top of screen
downFromTosB :: Int -> BufferM ()

-- | Move to <tt>n</tt> lines up from the bottom of the screen
upFromBosB :: Int -> BufferM ()

-- | Move to middle line in screen
middleB :: BufferM ()
pointInWindowB :: Point -> BufferM Bool

-- | Return the region between point and mark
getRawestSelectRegionB :: BufferM Region

-- | Return the empty region if the selection is not visible.
getRawSelectRegionB :: BufferM Region

-- | Get the current region boundaries. Extended to the current selection
--   unit.
getSelectRegionB :: BufferM Region

-- | Select the given region: set the selection mark at the
--   <a>regionStart</a> and the current point at the <a>regionEnd</a>.
setSelectRegionB :: Region -> BufferM ()

-- | Extend the selection mark using the given region.
extendSelectRegionB :: Region -> BufferM ()
deleteBlankLinesB :: BufferM ()

-- | Get a (lazy) stream of lines in the buffer, starting at the
--   <i>next</i> line in the given direction.
lineStreamB :: Direction -> BufferM [String]
getMaybeNextLineB :: Direction -> BufferM (Maybe String)
getNextLineB :: Direction -> BufferM String
getNextLineWhichB :: Direction -> (String -> Bool) -> BufferM (Maybe String)
getNextNonBlankLineB :: Direction -> BufferM String

-- | Uses a string modifying function to modify the current selection
--   Currently unsets the mark such that we have no selection, arguably we
--   could instead work out where the new positions should be and move the
--   mark and point accordingly.
modifySelectionB :: (String -> String) -> BufferM ()
modifyExtendedSelectionB :: TextUnit -> (String -> String) -> BufferM ()

-- | Prefix each line in the selection using the given string.
linePrefixSelectionB :: String -> BufferM ()

-- | Uncomments the selection using the given line comment starting string.
--   This only works for the comments which begin at the start of the line.
unLineCommentSelectionB :: String -> String -> BufferM ()

-- | Toggle line comments in the selection by adding or removing a prefix
--   to each line.
toggleCommentSelectionB :: String -> String -> BufferM ()

-- | Justifies all the lines of the selection to be the same as the top
--   line. NOTE: if the selection begins part way along a line, the other
--   lines will be justified only with respect to the part of the
--   indentation which is selected.
justifySelectionWithTopB :: BufferM ()

-- | Replace the contents of the buffer with some string
replaceBufferContent :: String -> BufferM ()

-- | Fill the text in the region so it fits nicely 80 columns.
fillRegion :: Region -> BufferM ()
fillParagraph :: BufferM ()

-- | Sort the lines of the region.
sortLines :: BufferM ()

-- | Helper function: revert the buffer contents to its on-disk version
revertB :: Rope -> UTCTime -> BufferM ()
smallBufferSize :: Int
shapeOfBlockRegionB :: Region -> BufferM (Point, [Int])
leftEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
rightEdgesOfRegionB :: RegionStyle -> Region -> BufferM [Point]
splitBlockRegionToContiguousSubRegionsB :: Region -> BufferM [Region]
deleteRegionWithStyleB :: Region -> RegionStyle -> BufferM Point
readRegionRopeWithStyleB :: Region -> RegionStyle -> BufferM Rope
insertRopeWithStyleB :: Rope -> RegionStyle -> BufferM ()
flipRectangleB :: Point -> Point -> BufferM (Point, Point)
movePercentageFileB :: Int -> BufferM ()
findMatchingPairB :: BufferM ()
instance Show RelPosition

module Yi.Buffer.Indent

-- | Return either a t or the number of spaces specified by tabSize in the
--   IndentSettings. Note that if you actually want to insert a tab
--   character (for example when editing makefiles) then you should use:
--   <tt>insertB '\t'</tt>.
tabB :: BufferM String

-- | Retrieve the current indentation settings for the buffer.
indentSettingsB :: BufferM IndentSettings

-- | A specialisation of <a>autoIndentHelperB</a>. This is the most basic
--   and the user is encouraged to specialise <a>autoIndentHelperB</a> on
--   their own.
autoIndentB :: IndentBehaviour -> BufferM ()

-- | This takes two arguments the first is a function to obtain indentation
--   hints from lines above the current one. The second is a function to
--   obtain a set of indentation hints from the previous line. Both of
--   these are in the <a>BufferM</a> monad although the second seems like
--   it is unnecessary. However we must take into account the length of
--   tabs which come from the the tab settings and hence we must be in the
--   <a>BufferM</a> monad.
--   
--   To get the straightforward behaviour of the indents of all previous
--   lines until one of them has zero indent call this with:
--   <tt>autoIndentHelperB fetchPreviousIndentsB (fmap (: [])
--   indentOfB)</tt> However commonly we wish to have something more
--   interesting for the second argument, in particular we commonly wish to
--   have the last opening bracket of the previous line as well as its
--   indent.
autoIndentHelperB :: BufferM [Int] -> (String -> BufferM [Int]) -> IndentBehaviour -> BufferM ()

-- | Cycles through the indentation hints. It does this without requiring
--   to set/get any state. We just look at the current indentation of the
--   current line and moving to the largest indent that is
cycleIndentsB :: IndentBehaviour -> [Int] -> BufferM ()

-- | A function generally useful as the first argument to
--   <a>autoIndentHelperB</a>. This searches the lines above the current
--   line for the indentations of each line until we get to a line which
--   has no indentation *and* is not empty. Indicating that we have reached
--   the outer scope.
fetchPreviousIndentsB :: BufferM [Int]

-- | An application of <a>autoIndentHelperB</a> which adds more indentation
--   hints using the given keywords. The offsets of the first set of
--   keywords are used as hints. For the second set of keywords it is not
--   the offsets of the keywords themselves but the offset of the first
--   non-white characters after the keywords.
--   
--   In addition to the keyword hints we also do the same as the default
--   (<a>autoIndentB</a>) which is to use any non-closed opening brackets
--   as hints.
autoIndentWithKeywordsB :: [String] -> [String] -> IndentBehaviour -> BufferM ()

-- | Returns the position of the last opening bracket on the line which is
--   not closed on the same line. Note that if we have unmatched
--   parentheses such as <a>( ]</a> then we may not get the correct answer,
--   but in that case then arguably we don't really care if we get the
--   correct answer (at least if we get it wrong the user may notice their
--   error). We return a list here as it's a convenient way of returning no
--   hint in the case of there being no non-closed bracket and normally
--   such a hint will be part of a list of hints anyway. NOTE: this could
--   be easily modified to return the indentations of *all* the non-closed
--   opening brackets. But I think this is not what you generally want.
--   TODO: we also do not care whether or not the bracket is within a
--   string or escaped. If someone feels up to caring about that by all
--   means please fix this.
lastOpenBracketHint :: String -> BufferM [Int]

-- | Returns the offsets of all the given keywords within the given string.
--   This is potentially useful as providing indentation hints.
keywordHints :: [String] -> String -> BufferM [Int]

-- | Returns the offsets of anything that isn't white space <tt>after</tt>
--   a keyword on the given line. This is essentially then the same as
--   <a>keywordHints</a> except that for each keyword on the input rather
--   than return the offset at the start of the keyword we return the
--   offset of the first non-white character after the keyword.
keywordAfterHints :: [String] -> String -> BufferM [Int]

-- | Returns the indentation of a given string. Note that this depends on
--   the current indentation settings.
indentOfB :: String -> BufferM Int

-- | Returns the length of a given string taking into account the white
--   space and the indentation settings.
spacingOfB :: String -> BufferM Int

-- | Indents the current line to the given indentation level. In addition
--   moves the point according to where it was on the line originally. If
--   we were somewhere within the indentation (ie at the start of the line
--   or on an empty line) then we want to just go to the end of the (new)
--   indentation. However if we are currently pointing somewhere within the
--   text of the line then we wish to remain pointing to the same
--   character.
indentToB :: Int -> BufferM ()

-- | Indent as much as the previous line
indentAsPreviousB :: BufferM ()

-- | Indent as much as the previous line
indentAsNextB :: BufferM ()
indentAsNeighborLineB :: Direction -> BufferM ()

-- | Insert a newline at point and indent the new line as the previous one.
newlineAndIndentB :: BufferM ()

-- | Set the padding of the string to newCount, filling in tabs if
--   expandTabs is set in the buffers IndentSettings
rePadString :: IndentSettings -> Int -> String -> String

-- | shifts right (or left if num is negative) num times, filling in tabs
--   if expandTabs is set in the buffers IndentSettings
indentString :: IndentSettings -> Int -> String -> String

-- | Increases the indentation on the region by the given amount of
--   shiftWidth
shiftIndentOfRegion :: Int -> Region -> BufferM ()
deleteIndentOfRegion :: Region -> BufferM ()

-- | Return the number of spaces at the beginning of the line, up to the
--   point.
indentOfCurrentPosB :: BufferM Int


-- | The <tt>Buffer</tt> module defines monadic editing operations over
--   one-dimensional buffers, maintaining a current <i>point</i>.
--   
--   This module acts as a Facade for the Buffer.* modules.
module Yi.Buffer
data UIUpdate
TextUpdate :: !Update -> UIUpdate
StyleUpdate :: !Point -> !Size -> UIUpdate

-- | Mutation actions (also used the undo or redo list)
--   
--   For the undo<i>redo, we use the </i>partial checkpoint/ (Berlage,
--   pg16) strategy to store just the components of the state that change.
--   
--   Note that the update direction is only a hint for moving the cursor
--   (mainly for undo purposes); the insertions and deletions are always
--   applied Forward.
data Update
Insert :: !Point -> !Direction -> !Rope -> Update
updatePoint :: Update -> !Point
updateDirection :: Update -> !Direction
insertUpdateString :: Update -> !Rope
Delete :: !Point -> !Direction -> !Rope -> Update
updatePoint :: Update -> !Point
updateDirection :: Update -> !Direction
deleteUpdateString :: Update -> !Rope
updateIsDelete :: Update -> Bool


-- | Utilities shared by various UIs
module Yi.UI.Utils
indexedAnnotatedStreamB :: Point -> BufferM [(Point, Char)]
applyHeights :: Traversable t => [Int] -> t Window -> t Window
spliceAnnots :: [(Point, Char)] -> [Span String] -> [(Point, Char)]

-- | Turn a sequence of (from,style,to) strokes into a sequence of picture
--   points (from,style), taking special care to ensure that the points are
--   strictly increasing and introducing padding segments where neccessary.
--   Precondition: Strokes are ordered and not overlapping.
strokePicture :: [Span (Endo a)] -> [(Point, a -> a)]

-- | Paint the given stroke-picture on top of an existing picture
paintStrokes :: (a -> a) -> a -> [(Point, a -> a)] -> [(Point, a)] -> [(Point, a)]
paintPicture :: a -> [[Span (Endo a)]] -> [(Point, a)]
attributesPictureB :: UIStyle -> Maybe SearchExp -> Region -> [[Span StyleName]] -> BufferM [(Point, Attributes)]
attributesPictureAndSelB :: UIStyle -> Maybe SearchExp -> Region -> BufferM [(Point, Attributes)]

-- | Arrange a list of items in columns over maximum
--   <tt>maxNumberOfLines</tt> lines
arrangeItems :: [String] -> Int -> Int -> [String]

-- | Arrange a list of items in columns over <tt>numberOfLines</tt> lines.
arrangeItems' :: [String] -> Int -> Int -> (Int, [String])

module Yi.Process

-- | A Posix.popen compatibility mapping. Based on PosixCompat, originally
--   written by Derek Elkins for lambdabot TODO: this will probably be
--   called readProcess in the new process package (2.0)
popen :: FilePath -> [String] -> Maybe String -> IO (String, String, ExitCode)

-- | Run a command. This looks up a program name in $PATH, but then calls
--   it directly with the argument.
runProgCommand :: String -> [String] -> IO (String, String, ExitCode)
runShellCommand :: String -> IO (String, String, ExitCode)

-- | Run a command using the system shell, returning stdout, stderr and
--   exit code
shellFileName :: IO String
createSubprocess :: FilePath -> [String] -> BufferRef -> IO SubprocessInfo
readAvailable :: Handle -> IO String
data SubprocessInfo
SubprocessInfo :: FilePath -> [String] -> ProcessHandle -> Handle -> Handle -> Handle -> BufferRef -> Bool -> SubprocessInfo
procCmd :: SubprocessInfo -> FilePath
procArgs :: SubprocessInfo -> [String]
procHandle :: SubprocessInfo -> ProcessHandle
hIn :: SubprocessInfo -> Handle
hOut :: SubprocessInfo -> Handle
hErr :: SubprocessInfo -> Handle
bufRef :: SubprocessInfo -> BufferRef
separateStdErr :: SubprocessInfo -> Bool
type SubprocessId = Integer

module Yi.Keymap.Vim2.StyledRegion
data StyledRegion
StyledRegion :: !RegionStyle -> !Region -> StyledRegion
normalizeRegion :: StyledRegion -> BufferM StyledRegion
transformCharactersInRegionB :: StyledRegion -> (Char -> Char) -> BufferM ()
transformCharactersInLineN :: Int -> (Char -> Char) -> BufferM ()

module Yi.Keymap.Vim2.TextObject
data TextObject
TextObject :: !RegionStyle -> !TextUnit -> TextObject
data CountedTextObject
CountedTextObject :: !Int -> !TextObject -> CountedTextObject
regionOfTextObjectB :: CountedTextObject -> BufferM StyledRegion
changeTextObjectCount :: Int -> CountedTextObject -> CountedTextObject
changeTextObjectStyle :: (RegionStyle -> RegionStyle) -> TextObject -> TextObject
stringToTextObject :: String -> Maybe TextObject

module Yi.Mode.Haskell.Dollarify
dollarify :: Tree TT -> BufferM ()
dollarifyWithin :: Tree TT -> BufferM ()
data QueuedUpdate
QueuedUpdate :: Point -> String -> Int -> QueuedUpdate
qUpdatePoint :: QueuedUpdate -> Point
qInsert :: QueuedUpdate -> String
qDelete :: QueuedUpdate -> Int
runQ :: [QueuedUpdate] -> BufferM ()
openParen :: Token
closeParen :: Token
isNormalParen :: Tree TT -> Bool
isTuple :: Tree TT -> Bool
queueDelete :: TT -> QueuedUpdate
queueReplaceWith :: String -> TT -> QueuedUpdate
stripComments :: Expr TT -> Expr TT
dollarifyTop :: Tree TT -> [QueuedUpdate]
dollarifyExpr :: Expr TT -> [QueuedUpdate]
isSimple :: Tree TT -> Bool
isCollapsible :: Expr TT -> Bool
selectedTree :: Expr TT -> Region -> Maybe (Tree TT)
findLargestWithin :: Region -> [Tree TT] -> Tree TT
within :: Region -> Tree TT -> Bool
safeLast :: [a] -> Maybe a
dollarifyP :: Tree TT -> BufferM ()
dollarifyWithinP :: Exp TT -> BufferM ()
isNormalParenP :: Exp TT -> Bool
isTupleP :: Exp TT -> Bool
stripCommentsP :: [Exp TT] -> [Exp TT]
dollarifyTopP :: Exp TT -> [QueuedUpdate]
dollarifyExprP :: [Exp TT] -> [QueuedUpdate]
isSimpleP :: Exp TT -> Bool
isCollapsibleP :: [Exp TT] -> Bool
selectedTreeP :: [Exp TT] -> Region -> Maybe (Exp TT)
findLargestWithinP :: Region -> [Exp TT] -> Exp TT
withinP :: Region -> Exp TT -> Bool
safeLastP :: [a] -> Maybe a
instance Eq QueuedUpdate
instance Ord QueuedUpdate
instance Show QueuedUpdate

module Yi.Style.Library
type Theme = Proto UIStyle

-- | Abstract theme that provides useful defaults.
defaultTheme :: Theme

-- | A Theme inspired by the darkblue colorscheme of Vim.
darkBlueTheme :: Theme

module Yi.Config
data UIConfig
UIConfig :: Int -> Maybe String -> Maybe Int -> Maybe ScrollStyle -> Int -> Bool -> Bool -> Bool -> Bool -> CursorStyle -> Char -> Theme -> UIConfig
configVtyEscDelay :: UIConfig -> Int

-- | Font name, for the UI that support it.
configFontName :: UIConfig -> Maybe String

-- | Font size, for the UI that support it.
configFontSize :: UIConfig -> Maybe Int

-- | Style of scroll
configScrollStyle :: UIConfig -> Maybe ScrollStyle

-- | Amount to move the buffer when using the scroll wheel
configScrollWheelAmount :: UIConfig -> Int

-- | Should the scrollbar be shown on the left side?
configLeftSideScrollBar :: UIConfig -> Bool

-- | Hide scrollbar automatically if text fits on one page.
configAutoHideScrollBar :: UIConfig -> Bool

-- | Hide the tabbar automatically if only one tab is present
configAutoHideTabBar :: UIConfig -> Bool

-- | Wrap lines at the edge of the window if too long to display.
configLineWrap :: UIConfig -> Bool
configCursorStyle :: UIConfig -> CursorStyle

-- | The char with which to fill empty window space. Usually '~' for
--   vi-like editors, ' ' for everything else.
configWindowFill :: UIConfig -> Char

-- | UI colours
configTheme :: UIConfig -> Theme

-- | When should we use a "fat" cursor (i.e. 2 pixels wide, rather than 1)?
--   Fat cursors have only been implemented for the Pango frontend.
data CursorStyle
AlwaysFat :: CursorStyle
NeverFat :: CursorStyle
FatWhenFocused :: CursorStyle
FatWhenFocusedAndInserting :: CursorStyle
configStyle :: UIConfig -> UIStyle

-- | Configuration record. All Yi hooks can be set here.
data Config
Config :: UIBoot -> UIConfig -> [Action] -> [Action] -> KeymapSet -> P Event Event -> [AnyMode] -> Bool -> RegionStyle -> Bool -> Bool -> [([Update] -> BufferM ())] -> [AnyLayoutManager] -> ConfigVariables -> Config

-- | UI to use.
startFrontEnd :: Config -> UIBoot

-- | UI-specific configuration.
configUI :: Config -> UIConfig

-- | Actions to run when the editor is started.
startActions :: Config -> [Action]

-- | Actions to run after startup (after startActions) or reload.
initialActions :: Config -> [Action]

-- | Default keymap to use.
defaultKm :: Config -> KeymapSet
configInputPreprocess :: Config -> P Event Event

-- | List modes by order of preference.
modeTable :: Config -> [AnyMode]

-- | Produce a .yi.dbg file with a lot of debug information.
debugMode :: Config -> Bool

-- | Set to <a>Exclusive</a> for an emacs-like behaviour.
configRegionStyle :: Config -> RegionStyle

-- | Set to <a>True</a> for an emacs-like behaviour, where all deleted text
--   is accumulated in a killring.
configKillringAccumulate :: Config -> Bool
configCheckExternalChangesObsessively :: Config -> Bool
bufferUpdateHandler :: Config -> [([Update] -> BufferM ())]

-- | List of layout managers for <tt>cycleLayoutManagersNext</tt>
layoutManagers :: Config -> [AnyLayoutManager]

-- | Custom configuration, containing the <tt>YiConfigVariable</tt>s.
--   Configure with <tt>configVariableA</tt>.
configVars :: Config -> ConfigVariables
configFundamentalMode :: Config -> AnyMode
configTopLevelKeymap :: Config -> Keymap
type UIBoot = Config -> (Event -> IO ()) -> ([Action] -> IO ()) -> Editor -> IO UI
configVarsA :: T Config ConfigVariables
layoutManagersA :: T Config [AnyLayoutManager]
bufferUpdateHandlerA :: T Config [[Update] -> BufferM ()]
configCheckExternalChangesObsessivelyA :: T Config Bool
configKillringAccumulateA :: T Config Bool
configRegionStyleA :: T Config RegionStyle
debugModeA :: T Config Bool
modeTableA :: T Config [AnyMode]
configInputPreprocessA :: T Config (P Event Event)
defaultKmA :: T Config KeymapSet
initialActionsA :: T Config [Action]
startActionsA :: T Config [Action]
configUIA :: T Config UIConfig
startFrontEndA :: T Config UIBoot
configThemeA :: T UIConfig Theme
configWindowFillA :: T UIConfig Char
configCursorStyleA :: T UIConfig CursorStyle
configLineWrapA :: T UIConfig Bool
configAutoHideTabBarA :: T UIConfig Bool
configAutoHideScrollBarA :: T UIConfig Bool
configLeftSideScrollBarA :: T UIConfig Bool
configScrollWheelAmountA :: T UIConfig Int
configScrollStyleA :: T UIConfig (Maybe ScrollStyle)
configFontSizeA :: T UIConfig (Maybe Int)
configFontNameA :: T UIConfig (Maybe String)
configVtyEscDelayA :: T UIConfig Int


-- | The top level editor state, and operations on it.
module Yi.Editor
type Status = ([String], StyleName)
type Statuses = DelayList Status

-- | The Editor state
data Editor
Editor :: ![BufferRef] -> !(Map BufferRef FBuffer) -> !Int -> !(PointedList Tab) -> !DynamicValues -> !Statuses -> !Int -> !Killring -> !(Maybe SearchExp) -> !Direction -> ![Event] -> !(Map BufferRef (EditorM ())) -> Editor

-- | Stack of all the buffers. Invariant: never empty Invariant: first
--   buffer is the current one.
bufferStack :: Editor -> ![BufferRef]
buffers :: Editor -> !(Map BufferRef FBuffer)

-- | Supply for buffer, window and tab ids.
refSupply :: Editor -> !Int

-- | current tab contains the visible windows pointed list.
tabs_ :: Editor -> !(PointedList Tab)

-- | dynamic components
dynamic :: Editor -> !DynamicValues
statusLines :: Editor -> !Statuses
maxStatusHeight :: Editor -> !Int
killring :: Editor -> !Killring

-- | currently highlighted regex (also most recent regex for use in vim
--   bindings)
currentRegex :: Editor -> !(Maybe SearchExp)
searchDirection :: Editor -> !Direction

-- | Processed events that didn't yield any action yet.
pendingEvents :: Editor -> ![Event]

-- | Actions to be run when the buffer is closed; should be scrapped.
onCloseActions :: Editor -> !(Map BufferRef (EditorM ()))
newtype EditorM a
EditorM :: RWS Config () Editor a -> EditorM a
fromEditorM :: EditorM a -> RWS Config () Editor a
class (Monad m, MonadState Editor m) => MonadEditor m where withEditor f = do { cfg <- askCfg; getsAndModify (runEditor cfg f) }
askCfg :: MonadEditor m => m Config
withEditor :: MonadEditor m => EditorM a -> m a
liftEditor :: MonadEditor m => EditorM a -> m a

-- | The initial state
emptyEditor :: Editor
runEditor :: Config -> EditorM a -> Editor -> (Editor, a)
onCloseActionsA :: T Editor (Map BufferRef (EditorM ()))
pendingEventsA :: T Editor [Event]
searchDirectionA :: T Editor Direction
currentRegexA :: T Editor (Maybe SearchExp)
killringA :: T Editor Killring
maxStatusHeightA :: T Editor Int
statusLinesA :: T Editor Statuses
dynamicA :: T Editor DynamicValues
tabs_A :: T Editor (PointedList Tab)
refSupplyA :: T Editor Int
buffersA :: T Editor (Map BufferRef FBuffer)
bufferStackA :: T Editor [BufferRef]
windows :: Editor -> PointedList Window
windowsA :: Accessor Editor (PointedList Window)
tabsA :: Accessor Editor (PointedList Tab)
currentTabA :: Accessor Editor Tab
askConfigVariableA :: (YiConfigVariable b, MonadEditor m) => m b
dynA :: YiVariable a => Accessor Editor a
newRef :: EditorM Int
newBufRef :: EditorM BufferRef

-- | Create and fill a new buffer, using contents of string. | Does not
--   focus the window, or make it the current window. | Call newWindowE or
--   switchToBufferE to take care of that.
stringToNewBuffer :: BufferId -> Rope -> EditorM BufferRef
insertBuffer :: FBuffer -> EditorM ()
forceFold1 :: Foldable t => t a -> t a
forceFoldTabs :: Foldable t => t Tab -> t Tab

-- | Delete a buffer (and release resources associated with it).
deleteBuffer :: BufferRef -> EditorM ()

-- | Return the buffers we have, <i>in no particular order</i>
bufferSet :: Editor -> [FBuffer]

-- | Return a prefix that can be removed from all buffer paths while
--   keeping them unique.
commonNamePrefix :: Editor -> [String]
getBufferStack :: EditorM [FBuffer]
findBuffer :: BufferRef -> EditorM (Maybe FBuffer)

-- | Find buffer with this key
findBufferWith :: BufferRef -> Editor -> FBuffer

-- | Find buffer with this name
findBufferWithName :: String -> Editor -> [BufferRef]

-- | Find buffer with given name. Fail if not found.
getBufferWithName :: String -> EditorM BufferRef

-- | Make all buffers visible by splitting the current window list. FIXME:
--   rename to displayAllBuffersE; make sure buffers are not open twice.
openAllBuffersE :: EditorM ()

-- | Rotate the buffer stack by the given amount.
shiftBuffer :: Int -> EditorM ()

-- | Perform action with any given buffer, using the last window that was
--   used for that buffer.
withGivenBuffer0 :: BufferRef -> BufferM a -> EditorM a

-- | Perform action with any given buffer
withGivenBufferAndWindow0 :: Window -> BufferRef -> BufferM a -> EditorM a

-- | Perform action with current window's buffer
withBuffer0 :: BufferM a -> EditorM a
currentWindowA :: Accessor Editor Window

-- | Return the current buffer
currentBuffer :: Editor -> BufferRef

-- | Display a transient message
printMsg :: String -> EditorM ()
printMsgs :: [String] -> EditorM ()
printStatus :: Status -> EditorM ()

-- | Set the <a>background</a> status line
setStatus :: Status -> EditorM ()

-- | Clear the status line
clrStatus :: EditorM ()
statusLine :: Editor -> [String]
statusLineInfo :: Editor -> Status
setTmpStatus :: Int -> Status -> EditorM ()

-- | Put string into yank register
setRegE :: String -> EditorM ()

-- | Return the contents of the yank register
getRegE :: EditorM String

-- | Dynamically-extensible state components.
--   
--   These hooks are used by keymaps to store values that result from
--   Actions (i.e. that restult from IO), as opposed to the pure values
--   they generate themselves, and can be stored internally.
--   
--   The <a>dynamic</a> field is a type-indexed map.
--   
--   Retrieve a value from the extensible state
getDynamic :: YiVariable a => EditorM a

-- | Insert a value into the extensible state, keyed by its type
setDynamic :: YiVariable a => a -> EditorM ()

-- | Attach the next buffer in the buffer stack to the current window.
nextBufW :: EditorM ()

-- | Attach the previous buffer in the stack list to the current window.
prevBufW :: EditorM ()

-- | Like fnewE, create a new buffer filled with the String <tt>s</tt>,
--   Switch the current window to this buffer. Doesn't associate any file
--   with the buffer (unlike fnewE) and so is good for popup internal
--   buffers (like scratch)
newBufferE :: BufferId -> Rope -> EditorM BufferRef

-- | Creates an in-memory buffer with a unique name.
--   
--   A hint for the buffer naming scheme can be specified in the dynamic
--   variable TempBufferNameHint The new buffer always has a buffer ID that
--   did not exist before newTempBufferE. TODO: this probably a lot more
--   complicated than it should be: why not count from zero every time?
newTempBufferE :: EditorM BufferRef

-- | Specifies the hint for the next temp buffer's name.
data TempBufferNameHint
TempBufferNameHint :: String -> Int -> TempBufferNameHint
tmp_name_base :: TempBufferNameHint -> String
tmp_name_index :: TempBufferNameHint -> Int
alternateBufferE :: Int -> EditorM ()

-- | Create a new zero size window on a given buffer
newZeroSizeWindow :: Bool -> BufferRef -> WindowRef -> Window

-- | Create a new window onto the given buffer.
newWindowE :: Bool -> BufferRef -> EditorM Window

-- | Attach the specified buffer to the current window
switchToBufferE :: BufferRef -> EditorM ()

-- | Attach the specified buffer to some other window than the current one
switchToBufferOtherWindowE :: BufferRef -> EditorM ()

-- | Switch to the buffer specified as parameter. If the buffer name is
--   empty, switch to the next buffer.
switchToBufferWithNameE :: String -> EditorM ()

-- | Close a buffer. Note: close the current buffer if the empty string is
--   given
closeBufferE :: String -> EditorM ()
getBufferWithNameOrCurrent :: String -> EditorM BufferRef

-- | Close current buffer and window, unless it's the last one.
closeBufferAndWindowE :: EditorM ()

-- | Rotate focus to the next window
nextWinE :: EditorM ()

-- | Rotate focus to the previous window
prevWinE :: EditorM ()

-- | Swaps the focused window with the first window. Useful for layouts
--   such as <tt>HPairOneStack</tt>, for which the first window is the
--   largest.
swapWinWithFirstE :: EditorM ()

-- | Moves the focused window to the first window, and moves all other
--   windows down the stack.
pushWinToFirstE :: EditorM ()

-- | Swap focused window with the next one
moveWinNextE :: EditorM ()

-- | Swap focused window with the previous one
moveWinPrevE :: EditorM ()

-- | A <a>fake</a> accessor that fixes the current buffer after a change of
--   the current window. Enforces invariant that top of buffer stack is the
--   buffer of the current window.
fixCurrentBufferA_ :: Accessor Editor Editor

-- | Counterpart of fixCurrentBufferA_: fix the current window to point to
--   the right buffer.
fixCurrentWindow :: EditorM ()
withWindowE :: Window -> BufferM a -> EditorM a
findWindowWith :: WindowRef -> Editor -> Window

-- | Return the windows that are currently open on the buffer whose key is
--   given
windowsOnBufferE :: BufferRef -> EditorM [Window]

-- | bring the editor focus the window with the given key.
--   
--   Fails if no window with the given key is found.
focusWindowE :: WindowRef -> EditorM ()

-- | Split the current window, opening a second window onto current buffer.
--   TODO: unfold newWindowE here?
splitE :: EditorM ()

-- | Cycle to the next layout manager, or the first one if the current one
--   is nonstandard.
layoutManagersNextE :: EditorM ()

-- | Cycle to the previous layout manager, or the first one if the current
--   one is nonstandard.
layoutManagersPreviousE :: EditorM ()

-- | Helper function for <tt>layoutManagersNext</tt> and
--   <tt>layoutManagersPrevious</tt>
withLMStack :: (PointedList AnyLayoutManager -> PointedList AnyLayoutManager) -> EditorM ()

-- | Next variant of the current layout manager, as given by
--   <a>nextVariant</a>
layoutManagerNextVariantE :: EditorM ()

-- | Previous variant of the current layout manager, as given by
--   <a>previousVariant</a>
layoutManagerPreviousVariantE :: EditorM ()

-- | Enlarge the current window
enlargeWinE :: EditorM ()

-- | Shrink the current window
shrinkWinE :: EditorM ()

-- | Sets the given divider position on the current tab
setDividerPosE :: DividerRef -> DividerPosition -> EditorM ()

-- | Creates a new tab containing a window that views the current buffer.
newTabE :: EditorM ()

-- | Moves to the next tab in the round robin set of tabs
nextTabE :: EditorM ()

-- | Moves to the previous tab in the round robin set of tabs
previousTabE :: EditorM ()

-- | Moves the focused tab to the given index, or to the end if the index
--   is not specified.
moveTab :: Maybe Int -> EditorM ()

-- | Deletes the current tab. If there is only one tab open then error out.
--   When the last tab is focused, move focus to the left, otherwise move
--   focus to the right.
deleteTabE :: EditorM ()

-- | Close the current window. If there is only one tab open and the tab
--   contains only one window then do nothing.
tryCloseE :: EditorM ()

-- | Make the current window the only window on the screen
closeOtherE :: EditorM ()

-- | Switch focus to some other window. If none is available, create one.
shiftOtherWindow :: MonadEditor m => m ()

-- | Execute the argument in the context of an other window. Create one if
--   necessary. The current window is re-focused after the argument has
--   completed.
withOtherWindow :: MonadEditor m => m a -> m a
acceptedInputs :: EditorM [String]

-- | Defines an action to be executed when the current buffer is closed.
--   
--   Used by the minibuffer to assure the focus is restored to the buffer
--   that spawned the minibuffer.
--   
--   todo: These actions are not restored on reload.
--   
--   todo: These actions should probably be very careful at what they do.
--   TODO: All in all, this is a very ugly way to achieve the purpose. The
--   nice way to proceed is to somehow attach the miniwindow to the window
--   that has spawned it.
onCloseBufferE :: BufferRef -> EditorM () -> EditorM ()
addJumpHereE :: EditorM ()
jumpBackE :: EditorM ()
jumpForwardE :: EditorM ()
modifyJumpListE :: (JumpList -> JumpList) -> EditorM ()
instance YiVariable TempBufferNameHint
instance Initializable TempBufferNameHint
instance Binary TempBufferNameHint
instance Typeable TempBufferNameHint
instance Show TempBufferNameHint
instance Typeable Editor
instance Typeable1 EditorM
instance Monad EditorM
instance MonadState Editor EditorM
instance MonadReader Config EditorM
instance Functor EditorM
instance MonadEditor EditorM
instance Applicative EditorM
instance Binary Editor

module Yi.UI.Common

-- | Record presenting a frontend's interface.
--   
--   The functions <a>layout</a> and <a>refresh</a> are both run by the
--   editor's main loop, in response to user actions and so on. Their
--   relation is a little subtle, and is discussed here:
--   
--   <ul>
--   <li>to see some code, look at the function <tt>refreshEditor</tt> in
--   <a>Yi.Core</a>. This is the only place where <a>layout</a> and
--   <a>refresh</a> are used.</li>
--   <li>the function <a>layout</a> is responsible for updating the
--   <a>Editor</a> with the width and height of the windows. Some
--   frontends, such as Pango, need to modify their internal state to do
--   this, and will consequently change their display. This is
--   expected.</li>
--   <li>the function <a>refresh</a> should cause the UI to update its
--   display with the information given in the <a>Editor</a>.</li>
--   <li>the functionalities of <a>layout</a> and <a>refresh</a> overlap to
--   some extent, in the sense that both may cause the frontend to update
--   its display. The Yi core provides the following guarantees which the
--   frontend may take advantage of:</li>
--   <li>in the main editor loop (i.e. in the <tt>refreshEditor</tt>
--   function), <a>layout</a> will be run (possibly multiple times) and
--   then <a>refresh</a> will be run. This guarantee will hold even in the
--   case of threading (the function <tt>refreshEditor</tt> will always be
--   run atomically, using <tt>MVar</tt>s).</li>
--   <li>between the last run of <a>layout</a> and the run of
--   <a>refresh</a>, some changes may be made to the <a>Editor</a>.
--   However, the text, text attributes, and (displayed) window region of
--   all windows will remain the same. However, the cursor location may
--   change.</li>
--   </ul>
--   
--   This guarantee allows frontends which calculate rendering of the text
--   during the <a>layout</a> stage to avoid recalculating the render again
--   during <a>refresh</a>. Pango is an example of such a frontend.
--   
--   The Yi core provides no guarantee about the OS thread from which the
--   functions <a>layout</a> and <a>refresh</a> are called from. In
--   particular, subprocesses (e.g. compilation, ghci) will run
--   <a>layout</a> and <a>refresh</a> from new OS threads (see
--   <tt>startSubprocessWatchers</tt> in <a>Yi.Core</a>). The frontend must
--   be preparaed for this: for instance, Gtk-based frontends should wrap
--   GUI updates in <tt>postGUIAsync</tt>.
data UI
UI :: IO () -> (Bool -> IO ()) -> IO () -> (Editor -> IO ()) -> IO () -> (Editor -> IO Editor) -> (FilePath -> IO ()) -> UI

-- | Main loop
main :: UI -> IO ()

-- | Clean up, and also terminate if given <tt>true</tt>
end :: UI -> Bool -> IO ()

-- | Suspend (or minimize) the program
suspend :: UI -> IO ()

-- | Refresh the UI with the given state
refresh :: UI -> Editor -> IO ()

-- | User force-refresh (in case the screen has been messed up from
--   outside)
userForceRefresh :: UI -> IO ()

-- | Set window width and height
layout :: UI -> Editor -> IO Editor

-- | Reload cabal project views
reloadProject :: UI -> FilePath -> IO ()
dummyUI :: UI

module Yi.UI.TabBar

-- | A TabDescr describes the properties of a UI tab independent of the
--   particular GUI in use.
data TabDescr
TabDescr :: String -> Bool -> TabDescr
tabText :: TabDescr -> String
tabInFocus :: TabDescr -> Bool
type TabBarDescr = PointedList TabDescr
tabBarDescr :: Editor -> TabBarDescr
tabAbbrevTitle :: String -> String

module Yi.Completion

-- | Complete a string given a user input string, a matching function and a
--   list of possibilites. Matching function should return the part of the
--   string that matches the user string.
completeInList :: String -> (String -> Maybe String) -> [String] -> EditorM String
completeInList' :: String -> (String -> Maybe String) -> [String] -> EditorM String

-- | Same as <a>completeInList</a>, but maps <tt>showFunction</tt> on
--   possible matches when printing
completeInListCustomShow :: (String -> String) -> String -> (String -> Maybe String) -> [String] -> EditorM String

-- | Return the longest common prefix of a set of lists.
--   
--   <pre>
--   P(xs) === all (isPrefixOf (commonPrefix xs)) xs
--   length s &gt; length (commonPrefix xs) --&gt; not (all (isPrefixOf s) xs)
--   </pre>
commonPrefix :: Eq a => [[a]] -> [a]

-- | Prefix matching function, for use with <a>completeInList</a>
prefixMatch :: String -> String -> Maybe String

-- | Infix matching function, for use with <a>completeInList</a>
infixMatch :: String -> String -> Maybe String

-- | Example: <a>abc</a> matches <a>a1b2c</a>
subsequenceMatch :: String -> String -> Bool
containsMatch' :: Bool -> String -> String -> Maybe String
containsMatch :: String -> String -> Maybe String
containsMatchCaseInsensitive :: String -> String -> Maybe String
mkIsPrefixOf :: Bool -> String -> String -> Bool

module Yi.History
type Histories = Map String History
data History
History :: Int -> [String] -> String -> History
_historyCurrent :: History -> Int
_historyContents :: History -> [String]
_historyPrefix :: History -> String
dynKeyA :: (Initializable v, Ord k) => k -> Accessor (Map k v) v
miniBuffer :: String
historyUp :: EditorM ()
historyDown :: EditorM ()
historyStart :: EditorM ()

-- | Start an input session with History
historyStartGen :: String -> EditorM ()
historyFinish :: EditorM ()

-- | Finish the current input session with history.
historyFinishGen :: String -> EditorM String -> EditorM ()
historyFind :: [String] -> Int -> Int -> Int -> String -> Int
historyMove :: String -> Int -> EditorM ()
historyMoveGen :: String -> Int -> EditorM String -> EditorM String
historyPrefixSet :: String -> EditorM ()
historyPrefixSet' :: String -> String -> EditorM ()
instance YiVariable (Map String History)
instance Binary History
instance Typeable History
instance Show History
instance Initializable History
instance (Typeable k, Typeable v) => Initializable (Map k v)


-- | emacs-style rectangle manipulation functions.
module Yi.Rectangle
alignRegion :: String -> BufferM ()

-- | Align each line of the region on the given regex. Fails if it is not
--   found in any line.
alignRegionOn :: String -> BufferM ()

-- | Get the selected region as a rectangle. Returns the region extended to
--   lines, plus the start and end columns of the rectangle.
getRectangle :: BufferM (Region, Int, Int)

-- | Split a list at the boundaries given
multiSplit :: [Int] -> [a] -> [[a]]
onRectangle :: (Int -> Int -> String -> String) -> BufferM ()
openRectangle :: BufferM ()
stringRectangle :: String -> BufferM ()
killRectangle :: EditorM ()
yankRectangle :: EditorM ()


-- | A module for CTags integration
module Yi.Tag

-- | Find the location of a tag using the tag table. Returns a full path
--   and line number
lookupTag :: Tag -> TagTable -> Maybe (FilePath, Int)

-- | Read in a tag file from the system
importTagTable :: FilePath -> IO TagTable

-- | Gives all the possible expanded tags that could match a given
--   <tt>prefix</tt>
hintTags :: TagTable -> String -> [String]

-- | Extends the string to the longest certain length
completeTag :: TagTable -> String -> String
type Tag = String
data TagTable
TagTable :: FilePath -> FilePath -> Map Tag (FilePath, Int) -> Trie -> TagTable

-- | local name of the tag file TODO: reload if this file is changed
tagFileName :: TagTable -> FilePath

-- | path to the tag file directory tags are relative to this path
tagBaseDir :: TagTable -> FilePath

-- | map from tags to files
tagFileMap :: TagTable -> Map Tag (FilePath, Int)

-- | trie to speed up tag hinting
tagTrie :: TagTable -> Trie

-- | Get the currently registered tag table
getTags :: EditorM (Maybe TagTable)

-- | Set a new TagTable
setTags :: TagTable -> EditorM ()

-- | Reset the TagTable
resetTags :: EditorM ()
getTagsFileList :: EditorM [FilePath]
setTagsFileList :: String -> EditorM ()
instance YiVariable TagsFileList
instance YiVariable Tags
instance Binary TagsFileList
instance Binary TagTable
instance Binary Tags
instance Typeable TagsFileList
instance Typeable TagTable
instance Typeable Tags
instance Initializable TagsFileList
instance Initializable Tags

module Yi.Keymap.Vim.TagStack
newtype VimTagStack
VimTagStack :: [(FilePath, Point)] -> VimTagStack
tagsStack :: VimTagStack -> [(FilePath, Point)]
getTagStack :: EditorM VimTagStack
setTagStack :: VimTagStack -> EditorM ()
listTagStack :: EditorM [(FilePath, Point)]
pushTagStack :: FilePath -> Point -> EditorM ()
peekTagStack :: EditorM (Maybe (FilePath, Point))
popTagStack :: Int -> EditorM (Maybe (FilePath, Point))
instance Typeable VimTagStack
instance Binary VimTagStack
instance YiVariable VimTagStack
instance Initializable VimTagStack

module Yi.Keymap
data Action
YiA :: (YiM a) -> Action
EditorA :: (EditorM a) -> Action
BufferA :: (BufferM a) -> Action
emptyAction :: Action
type Interact ev a = I ev Action a
type KeymapM a = Interact Event a
type Keymap = KeymapM ()
type KeymapEndo = Keymap -> Keymap
type KeymapProcess = P Event Action
data KeymapSet
KeymapSet :: Keymap -> Keymap -> Keymap -> Keymap -> KeymapSet

-- | Content of the top-level loop.
topKeymap :: KeymapSet -> Keymap

-- | Startup when entering insert mode
startInsertKeymap :: KeymapSet -> Keymap

-- | For insertion-only modes
insertKeymap :: KeymapSet -> Keymap

-- | Startup bit, to execute only once at the beginning.
startTopKeymap :: KeymapSet -> Keymap
topKeymapA :: T KeymapSet Keymap
startInsertKeymapA :: T KeymapSet Keymap
insertKeymapA :: T KeymapSet Keymap
startTopKeymapA :: T KeymapSet Keymap
extractTopKeymap :: KeymapSet -> Keymap
modelessKeymapSet :: Keymap -> KeymapSet

-- | The type of user-bindable functions
newtype YiM a
YiM :: ReaderT Yi IO a -> YiM a
runYiM :: YiM a -> ReaderT Yi IO a
withUI :: (UI -> IO a) -> YiM a
unsafeWithEditor :: Config -> MVar YiVar -> EditorM a -> IO a
withGivenBuffer :: MonadEditor m => BufferRef -> BufferM a -> m a
withBuffer :: MonadEditor m => BufferM a -> m a
readEditor :: MonadEditor m => (Editor -> a) -> m a
catchDynE :: Exception exception => YiM a -> (exception -> YiM a) -> YiM a
catchJustE :: Exception e => (e -> Maybe b) -> YiM a -> (b -> YiM a) -> YiM a
handleJustE :: Exception e => (e -> Maybe b) -> (b -> YiM a) -> YiM a -> YiM a

-- | Shut down all of our threads. Should free buffers etc.
shutdown :: YiM ()
class YiAction a x | a -> x
makeAction :: (YiAction a x, Show x) => a -> Action
data Yi
Yi :: UI -> (Event -> IO ()) -> ([Action] -> IO ()) -> Config -> MVar YiVar -> Yi
yiUi :: Yi -> UI

-- | input stream
input :: Yi -> Event -> IO ()

-- | output stream
output :: Yi -> [Action] -> IO ()
yiConfig :: Yi -> Config

-- | The only mutable state in the program
yiVar :: Yi -> MVar YiVar
data YiVar
YiVar :: !Editor -> ![ThreadId] -> !SubprocessId -> !(Map SubprocessId SubprocessInfo) -> YiVar
yiEditor :: YiVar -> !Editor

-- | all our threads
threads :: YiVar -> ![ThreadId]
yiSubprocessIdSupply :: YiVar -> !SubprocessId
yiSubprocesses :: YiVar -> !(Map SubprocessId SubprocessInfo)

-- | <tt>write a</tt> returns a keymap that just outputs the action
--   <tt>a</tt>.
write :: (MonadInteract m Action ev, YiAction a x, Show x) => a -> m ()
instance Typeable Action
instance Typeable1 YiM
instance Typeable Yi
instance Monad YiM
instance MonadReader Yi YiM
instance MonadIO YiM
instance Functor YiM
instance PEq Event
instance YiAction Action ()
instance YiAction (BufferM x) x
instance YiAction (EditorM x) x
instance YiAction (YiM x) x
instance YiAction (IO x) x
instance MonadEditor YiM
instance MonadState Editor YiM
instance Show Action
instance PEq Action


-- | This module defines a list type and operations on it; it further
--   provides functions which write in and out the list. The goal is to
--   make it easy for the user to store a large number of text buffers and
--   cycle among them, making edits as she goes. The idea is inspired by
--   "incremental reading", see
--   <a>http://en.wikipedia.org/wiki/Incremental_reading</a>.
module Yi.IReader
type Article = ByteString
newtype ArticleDB
ADB :: Seq Article -> ArticleDB
unADB :: ArticleDB -> Seq Article

-- | Take an <a>ArticleDB</a>, and return the first <a>Article</a> and an
--   ArticleDB - *without* that article.
split :: ArticleDB -> (Article, ArticleDB)

-- | Get the first article in the list. We use the list to express relative
--   priority; the first is the most, the last least. We then just cycle
--   through - every article gets equal time.
getLatestArticle :: ArticleDB -> Article

-- | We remove the old first article, and we stick it on the end of the
--   list using the presumably modified version.
removeSetLast :: ArticleDB -> Article -> ArticleDB
shift :: Int -> ArticleDB -> ArticleDB

-- | Insert a new article with top priority (that is, at the front of the
--   list).
insertArticle :: ArticleDB -> Article -> ArticleDB

-- | Serialize given <a>ArticleDB</a> out.
writeDB :: ArticleDB -> YiM ()

-- | Read in database from <a>getArticleDbFilename</a> and then parse it
--   into an <a>ArticleDB</a>.
readDB :: YiM ArticleDB

-- | Returns the database as it exists on the disk, and the current Yi
--   buffer contents. Note that the Initializable typeclass gives us an
--   empty Seq. So first we try the buffer state in the hope we can avoid a
--   very expensive read from disk, and if we find nothing (that is, if we
--   get an empty Seq), only then do we call <a>readDB</a>.
oldDbNewArticle :: YiM (ArticleDB, Article)
getBufferContents :: BufferM String

-- | Given an <a>ArticleDB</a>, dump the scheduled article into the buffer
--   (replacing previous contents).
setDisplayedArticle :: ArticleDB -> YiM ()

-- | Go to next one. This ignores the buffer, but it doesn't remove
--   anything from the database. However, the ordering does change.
nextArticle :: YiM ()

-- | Delete current article (the article as in the database), and go to
--   next one.
deleteAndNextArticle :: YiM ()

-- | The main action. We fetch the old database, we fetch the modified
--   article from the buffer, then we call the function
--   <tt>updateSetLast</tt> which removes the first article and pushes our
--   modified article to the end of the list.
saveAndNextArticle :: Int -> YiM ()

-- | Assume the buffer is an entirely new article just imported this
--   second, and save it. We don't want to use <tt>updateSetLast</tt> since
--   that will erase an article.
saveAsNewArticle :: YiM ()
instance Typeable ArticleDB
instance Binary ArticleDB
instance YiVariable ArticleDB
instance Initializable ArticleDB


-- | Combinators for building keymaps.
module Yi.Keymap.Keys
printableChar :: MonadInteract m w Event => m Char

-- | Parse any character that can be inserted in the text.
textChar :: KeymapM Char
charOf :: MonadInteract m w Event => (Event -> Event) -> Char -> Char -> m Char
shift :: Event -> Event
meta :: Event -> Event
ctrl :: Event -> Event
super :: Event -> Event
hyper :: Event -> Event

-- | Convert a special key into an event
spec :: Key -> Event
char :: Char -> Event
(>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => m b -> a -> m ()
(>>=!) :: (MonadInteract m Action Event, YiAction a x, Show x) => m b -> (b -> a) -> m ()
(?>>) :: MonadInteract m action Event => Event -> m a -> m a
(?>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => Event -> a -> m ()
(?*>>) :: MonadInteract m action Event => [Event] -> m a -> m a
(?*>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => [Event] -> a -> m ()
ctrlCh :: Char -> Event
metaCh :: Char -> Event
hyperCh :: Char -> Event

-- | <tt>optMod f ev</tt> produces a <a>MonadInteract</a> that consumes
--   <tt>ev</tt> or <tt>f ev</tt>
optMod :: MonadInteract m w Event => (Event -> Event) -> Event -> m Event
pString :: MonadInteract m w Event => String -> m [Event]

module Yi.Keymap.Emacs.KillRing

-- | C-w
killRegion :: BufferM ()

-- | C-k
killLineE :: Maybe Int -> YiM ()
killringPut :: Direction -> String -> EditorM ()

-- | Kill the rest of line
killRestOfLine :: BufferM ()

-- | C-y
yankE :: EditorM ()

-- | M-w
killRingSaveE :: EditorM ()

-- | M-y
yankPopE :: EditorM ()

-- | C-M-w
appendNextKillE :: EditorM ()

module Yi.Keymap.Readline

-- | Readline-like movement bindings intended for minibuffer keymaps
standardMovementBindings :: Keymap

module Yi.Keymap.Vim2.Common
data VimMode
Normal :: VimMode
NormalOperatorPending :: OperatorName -> VimMode

-- | char denotes how state got into insert mode (<tt>i</tt>, <tt>a</tt>,
--   etc.)
Insert :: Char -> VimMode
Replace :: VimMode
ReplaceSingleChar :: VimMode

-- | after C-o
InsertNormal :: VimMode

-- | after C-o and one of v, V, C-v
InsertVisual :: VimMode
Visual :: RegionStyle -> VimMode
Ex :: VimMode
Search :: VimMode -> Direction -> VimMode
previousMode :: VimMode -> VimMode
direction :: VimMode -> Direction
data VimBinding
VimBindingY :: (EventString -> VimState -> MatchResult ()) -> (EventString -> YiM RepeatToken) -> VimBinding
vbPrerequisite :: VimBinding -> EventString -> VimState -> MatchResult ()
vbyAction :: VimBinding -> EventString -> YiM RepeatToken
VimBindingE :: (EventString -> VimState -> MatchResult ()) -> (EventString -> EditorM RepeatToken) -> VimBinding
vbPrerequisite :: VimBinding -> EventString -> VimState -> MatchResult ()
vbeAction :: VimBinding -> EventString -> EditorM RepeatToken
data GotoCharCommand
GotoCharCommand :: !Char -> !Direction -> !RegionStyle -> GotoCharCommand
data VimState
VimState :: !VimMode -> !(Maybe Int) -> !EventString -> !EventString -> !(HashMap RegisterName Register) -> !RegisterName -> !(Maybe RepeatableAction) -> !EventString -> !Bool -> !EventString -> !(Maybe GotoCharCommand) -> !EventString -> ![Point] -> !Bool -> VimState
vsMode :: VimState -> !VimMode
vsCount :: VimState -> !(Maybe Int)

-- | for repeat and potentially macros
vsAccumulator :: VimState -> !EventString
vsTextObjectAccumulator :: VimState -> !EventString
vsRegisterMap :: VimState -> !(HashMap RegisterName Register)
vsActiveRegister :: VimState -> !RegisterName
vsRepeatableAction :: VimState -> !(Maybe RepeatableAction)

-- | see Yi.Keymap.Vim2.vimEval comment
vsStringToEval :: VimState -> !EventString

-- | is set on $, allows j and k walk the right edge of lines
vsStickyEol :: VimState -> !Bool
vsOngoingInsertEvents :: VimState -> !EventString
vsLastGotoCharCommand :: VimState -> !(Maybe GotoCharCommand)
vsBindingAccumulator :: VimState -> !EventString
vsSecondaryCursors :: VimState -> ![Point]

-- | like vim's :help paste
vsPaste :: VimState -> !Bool
data Register
Register :: RegionStyle -> Rope -> Register
regRegionStyle :: Register -> RegionStyle
regContent :: Register -> Rope
data RepeatToken
Finish :: RepeatToken
Drop :: RepeatToken
Continue :: RepeatToken
data RepeatableAction
RepeatableAction :: !Int -> !EventString -> RepeatableAction
raPreviousCount :: RepeatableAction -> !Int
raActionString :: RepeatableAction -> !EventString
data MatchResult a
NoMatch :: MatchResult a
PartialMatch :: MatchResult a
WholeMatch :: a -> MatchResult a
type EventString = String
type OperatorName = String
type RegisterName = Char
instance Show RepeatToken
instance YiVariable VimState
instance Binary VimState
instance Initializable VimState
instance Binary VimMode
instance Initializable VimMode
instance Binary GotoCharCommand
instance Binary Register
instance Binary RepeatableAction
instance Typeable RepeatableAction
instance Typeable VimMode
instance Typeable VimState
instance Eq RepeatableAction
instance Show RepeatableAction
instance Eq VimMode
instance Show VimMode

module Yi.Keymap.Vim2.EventUtils
stringToEvent :: String -> Event
eventToString :: Event -> String
parseEvents :: String -> [Event]
stringToRepeatableAction :: String -> RepeatableAction
normalizeCount :: String -> String
splitCountedCommand :: String -> (Int, String)

module Yi.Keymap.Vim2.StateUtils
switchMode :: VimMode -> VimState -> VimState
switchModeE :: VimMode -> EditorM ()
resetCount :: VimState -> VimState
resetCountE :: EditorM ()
setCountE :: Int -> EditorM ()
modifyStateE :: (VimState -> VimState) -> EditorM ()
getMaybeCountE :: EditorM (Maybe Int)
getCountE :: EditorM Int
accumulateEventE :: Event -> EditorM ()
accumulateBindingEventE :: Event -> EditorM ()
accumulateTextObjectEventE :: EventString -> EditorM ()
flushAccumulatorIntoRepeatableActionE :: EditorM ()
dropAccumulatorE :: EditorM ()
dropBindingAccumulatorE :: EditorM ()
dropTextObjectAccumulatorE :: EditorM ()
setRegisterE :: RegisterName -> RegionStyle -> Rope -> EditorM ()
getRegisterE :: RegisterName -> EditorM (Maybe Register)
normalizeCountE :: Maybe Int -> EditorM ()
setStickyEolE :: Bool -> EditorM ()
maybeMult :: Num a => Maybe a -> Maybe a -> Maybe a
updateModeIndicatorE :: VimMode -> EditorM ()
saveInsertEventStringE :: EventString -> EditorM ()

module Yi.Keymap.Vim2.Eval
scheduleActionStringForEval :: String -> EditorM ()

module Yi.Keymap.Vim2.Motion
data Move
Move :: !RegionStyle -> !Bool -> (Maybe Int -> BufferM ()) -> Move
moveStyle :: Move -> !RegionStyle
moveIsJump :: Move -> !Bool
moveAction :: Move -> (Maybe Int -> BufferM ())
data CountedMove
CountedMove :: !(Maybe Int) -> !Move -> CountedMove
stringToMove :: String -> MatchResult Move
regionOfMoveB :: CountedMove -> BufferM StyledRegion
changeMoveStyle :: (RegionStyle -> RegionStyle) -> Move -> Move
instance Functor ((,,) a b)

module Yi.Keymap.Vim2.Utils
mkBindingE :: VimMode -> RepeatToken -> (Event, EditorM (), VimState -> VimState) -> VimBinding
mkBindingY :: VimMode -> (Event, YiM (), VimState -> VimState) -> VimBinding
mkStringBindingE :: VimMode -> RepeatToken -> (String, EditorM (), VimState -> VimState) -> VimBinding
splitCountedCommand :: String -> (Int, String)
selectBinding :: String -> VimState -> [VimBinding] -> MatchResult VimBinding
matchFromBool :: Bool -> MatchResult ()
mkMotionBinding :: RepeatToken -> (VimMode -> Bool) -> VimBinding
mkChooseRegisterBinding :: (VimState -> Bool) -> VimBinding
pasteInclusiveB :: Rope -> RegionStyle -> BufferM ()
addNewLineIfNecessary :: Rope -> Rope
indentBlockRegionB :: Int -> Region -> BufferM ()

module Yi.Keymap.Vim2.ReplaceMap
defReplaceMap :: [VimBinding]

module Yi.Keymap.Vim2.ReplaceSingleCharMap
defReplaceSingleMap :: [VimBinding]

module Yi.Keymap.Vim2.Ex.Types
data ExCommand
ExCommand :: YiM [String] -> Bool -> Action -> Bool -> String -> ExCommand
cmdComplete :: ExCommand -> YiM [String]
cmdIsPure :: ExCommand -> Bool
cmdAction :: ExCommand -> Action
cmdAcceptsRange :: ExCommand -> Bool
cmdShow :: ExCommand -> String
data LineRange

-- | 'a,'b
MarkRange :: String -> String -> LineRange

-- | %
FullRange :: LineRange
CurrentLineRange :: LineRange
stringToExCommand :: [String -> Maybe ExCommand] -> String -> Maybe ExCommand
instance Show ExCommand

module Yi.Keymap.Vim2.Ex.Eval
exEvalE :: [String -> Maybe ExCommand] -> String -> EditorM ()
exEvalY :: [String -> Maybe ExCommand] -> String -> YiM ()


-- | The core actions of yi. This module is the link between the editor and
--   the UI. Key bindings, and libraries should manipulate Yi through the
--   interface defined here.
module Yi.Core

-- | Start up the editor, setting any state with the user preferences and
--   file names passed in, and turning on the UI
startEditor :: Config -> Maybe Editor -> IO ()

-- | Quit.
quitEditor :: YiM ()

-- | Redraw
refreshEditor :: YiM ()

-- | Suspend the program
suspendEditor :: YiM ()
userForceRefresh :: YiM ()
msgEditor :: String -> YiM ()

-- | Show an error on the status line and log it.
errorEditor :: String -> YiM ()

-- | Close the current window. If this is the last window open, quit the
--   program. CONSIDER: call quitEditor when there are no other window in
--   the <a>interactive</a> function. (Not possible since the windowset
--   type disallows it -- should it be relaxed?)
closeWindow :: YiM ()

-- | Pipe a string through an external command, returning the stdout chomp
--   any trailing newline (is this desirable?)
--   
--   Todo: varients with marks?
runProcessWithInput :: String -> String -> YiM String

-- | Start a subprocess with the given command and arguments.
startSubprocess :: FilePath -> [String] -> (Either SomeException ExitCode -> YiM x) -> YiM BufferRef
sendToProcess :: BufferRef -> String -> YiM ()
runAction :: Action -> YiM ()
withSyntax :: (Show x, YiAction a x) => (forall syntax. Mode syntax -> syntax -> a) -> YiM ()
focusAllSyntax :: Editor -> Editor


module Yi.UI.Pango.Control
data Control
Control :: Yi -> IORef [TabInfo] -> IORef (Map WindowRef View) -> Control
controlYi :: Control -> Yi
tabCache :: Control -> IORef [TabInfo]
views :: Control -> IORef (Map WindowRef View)
newtype ControlM a
ControlM :: ReaderT Control IO a -> ControlM a
runControl'' :: ControlM a -> ReaderT Control IO a
data Buffer
Buffer :: BufferRef -> Buffer
fBufRef :: Buffer -> BufferRef
data View
View :: BufferRef -> WindowRef -> DrawingArea -> PangoLayout -> Language -> FontMetrics -> ScrolledWindow -> IORef Point -> IORef (Maybe (ConnectId DrawingArea)) -> View
viewFBufRef :: View -> BufferRef
windowRef :: View -> WindowRef
drawArea :: View -> DrawingArea
layout :: View -> PangoLayout
language :: View -> Language
metrics :: View -> FontMetrics
scrollWin :: View -> ScrolledWindow
shownTos :: View -> IORef Point
winMotionSignal :: View -> IORef (Maybe (ConnectId DrawingArea))
data Iter
Iter :: BufferRef -> Point -> Iter
iterFBufRef :: Iter -> BufferRef
point :: Iter -> Point
startControl :: Config -> ControlM () -> IO ()
runControl :: ControlM a -> Control -> IO a
controlIO :: IO a -> ControlM a
liftYi :: YiM a -> ControlM a
getControl :: ControlM Control
newBuffer :: BufferId -> String -> ControlM Buffer
newView :: Buffer -> FontDescription -> ControlM View
getBuffer :: View -> Buffer
setBufferMode :: FilePath -> Buffer -> ControlM ()
withBuffer :: Buffer -> BufferM a -> ControlM a
setText :: Buffer -> String -> ControlM ()
getText :: Buffer -> Iter -> Iter -> ControlM String
instance Typeable1 ControlM
instance Monad ControlM
instance MonadIO ControlM
instance MonadReader Control ControlM
instance Functor ControlM
instance Applicative ControlM
instance Show TabInfo


-- | Search/Replace functions
module Yi.Search

-- | Put regex into regex <tt>register</tt>
setRegexE :: SearchExp -> EditorM ()

-- | Clear the regex <tt>register</tt>
resetRegexE :: EditorM ()

-- | Return contents of regex register
getRegexE :: EditorM (Maybe SearchExp)

-- | Global searching. Search for regex and move point to that position.
--   <tt>Nothing</tt> means reuse the last regular expression. <tt>Just
--   s</tt> means use <tt>s</tt> as the new regular expression. Direction
--   of search can be specified as either <tt>Backward</tt> or
--   <tt>Forward</tt> (forwards in the buffer). Arguments to modify the
--   compiled regular expression can be supplied as well.
type SearchMatch = Region
data SearchResult
PatternFound :: SearchResult
PatternNotFound :: SearchResult
SearchWrapped :: SearchResult
data SearchOption

-- | Compile for matching that ignores char case
IgnoreCase :: SearchOption

-- | Compile for newline-insensitive matching
NoNewLine :: SearchOption

-- | Treat the input not as a regex but as a literal string to search for.
QuoteRegex :: SearchOption
doSearch :: Maybe String -> [SearchOption] -> Direction -> EditorM SearchResult

-- | Set up a search.
searchInit :: String -> Direction -> [SearchOption] -> EditorM (SearchExp, Direction)

-- | Do a search, placing cursor at first char of pattern, if found.
--   Keymaps may implement their own regex language. How do we provide for
--   this? Also, what's happening with ^ not matching sol?
continueSearch :: (SearchExp, Direction) -> BufferM SearchResult

-- | Create a SearchExp that matches exactly its argument
makeSimpleSearch :: String -> SearchExp

-- | Search and Replace all within the current region. Note the region is
--   the final argument since we might perform the same search and replace
--   over multiple regions however we are unlikely to perform several
--   search and replaces over the same region since the first such may
--   change the bounds of the region.
searchReplaceRegionB :: String -> String -> Region -> BufferM Int

-- | Peform a search and replace on the selection
searchReplaceSelectionB :: String -> String -> BufferM Int

-- | Replace a string by another everywhere in the document
replaceString :: String -> String -> BufferM Int
searchAndRepRegion :: String -> String -> Bool -> Region -> EditorM Bool

-- | Search and replace in the given region. If the input boolean is True,
--   then the replace is done globally, otherwise only the first match is
--   replaced. Returns the number of replacements done.
searchAndRepRegion0 :: SearchExp -> String -> Bool -> Region -> BufferM Int

-- | Search and replace in the region defined by the given unit. The rest
--   is as in <a>searchAndRepRegion</a>.
searchAndRepUnit :: String -> String -> Bool -> TextUnit -> EditorM Bool
isearchInitE :: Direction -> EditorM ()
isearchIsEmpty :: EditorM Bool
isearchAddE :: String -> EditorM ()
isearchPrevE :: EditorM ()
isearchNextE :: EditorM ()
isearchWordE :: EditorM ()
isearchHistory :: Int -> EditorM ()
isearchDelE :: EditorM ()
isearchCancelE :: EditorM ()
isearchFinishE :: EditorM ()

-- | Find the next match and select it. Point is end, mark is beginning.
qrNext :: Window -> BufferRef -> SearchExp -> EditorM ()

-- | Replace all the remaining occurrences.
qrReplaceAll :: Window -> BufferRef -> SearchExp -> String -> EditorM ()
qrReplaceOne :: Window -> BufferRef -> SearchExp -> String -> EditorM ()

-- | Exit from query/replace.
qrFinish :: EditorM ()
instance Typeable Isearch
instance Eq SearchResult
instance Binary Isearch
instance YiVariable Isearch
instance Initializable Isearch

module Yi.Keymap.Vim2.Search
doVimSearch :: Maybe String -> [SearchOption] -> Direction -> EditorM ()
continueVimSearch :: (SearchExp, Direction) -> BufferM ()

module Yi.Keymap.Vim2.SearchMotionMap
defSearchMotionMap :: [VimBinding]


-- | Provides functions for calling Hoogle on the commandline, and
--   processing results into a form useful for completion or insertion.
module Yi.Hoogle

-- | Remove anything starting with uppercase letter. These denote either
--   module names or types.
caseSensitize :: [String] -> [String]

-- | Hoogle's output includes a sort of type keyword, telling whether a hit
--   is a package name, syntax, a module name, etc. But we care primarily
--   about the function names, so we filter out anything containing the
--   keywords.
gv :: [String] -> [String]

-- | Query Hoogle, with given search and options. This errors out on no
--   results or if the hoogle command is not on path.
hoogleRaw :: String -> String -> IO [String]

-- | Filter the output of <a>hoogleRaw</a> to leave just functions.
hoogleFunctions :: String -> IO [String]

-- | Return module-function pairs.
hoogleFunModule :: String -> IO [(String, String)]

-- | Call out to <a>hoogleFunModule</a>, and overwrite the word at point
--   with the first returned function.
hoogle :: YiM String

-- | Call out to <a>hoogleRaw</a>, and print inside the Minibuffer the
--   results of searching Hoogle with the word at point.
hoogleSearch :: YiM ()

module Yi.TextCompletion
wordComplete :: YiM ()
wordComplete' :: Bool -> YiM ()
wordCompleteString :: YiM String
wordCompleteString' :: Bool -> YiM String

-- | Try to complete the current word with occurences found elsewhere in
--   the editor. Further calls try other options.
mkWordComplete :: YiM String -> (String -> YiM [String]) -> ([String] -> YiM ()) -> (String -> String -> Bool) -> YiM String

-- | Switch out of completion mode.
resetComplete :: EditorM ()
completeWordB :: EditorM ()
instance Typeable Completion
instance Binary Completion
instance YiVariable Completion
instance Initializable Completion

module Yi.Keymap.Vim2.InsertMap
defInsertMap :: [(String, Char)] -> [VimBinding]

module Yi.Mode.Buffers
listBuffers :: YiM ()


-- | This module defines a user interface implemented using vty.
module Yi.UI.Vty

-- | Initialise the ui
start :: UIBoot

module Yi.MiniBuffer

-- | Open a minibuffer window with the given prompt and keymap The third
--   argument is an action to perform after the minibuffer is opened such
--   as move to the first occurence of a searched for string. If you don't
--   need this just supply <tt>return ()</tt>
spawnMinibufferE :: String -> KeymapEndo -> EditorM BufferRef
withMinibufferFree :: String -> (String -> YiM ()) -> YiM ()

-- | <tt>withMinibuffer prompt completer act</tt>: open a minibuffer with
--   <tt>prompt</tt>. Once a string <tt>s</tt> is obtained, run <tt>act
--   s</tt>. <tt>completer</tt> can be used to complete functions: it
--   returns a list of possible matches.
withMinibuffer :: String -> (String -> YiM [String]) -> (String -> YiM ()) -> YiM ()

-- | <tt>withMinibufferGen proposal getHint prompt completer act</tt>: open
--   a minibuffer with <tt>prompt</tt>, and initial content
--   <tt>proposal</tt>. Once a string <tt>s</tt> is obtained, run <tt>act
--   s</tt>. <tt>completer</tt> can be used to complete inputs by returning
--   an incrementally better match, and getHint can give an immediate
--   feedback to the user on the current input.
withMinibufferGen :: String -> (String -> YiM [String]) -> String -> (String -> YiM String) -> (String -> YiM ()) -> YiM ()

-- | Open a minibuffer, given a finite number of suggestions.
withMinibufferFin :: String -> [String] -> (String -> YiM ()) -> YiM ()
noHint :: String -> YiM [String]
noPossibilities :: String -> YiM [String]
mkCompleteFn :: (String -> (String -> Maybe String) -> [String] -> EditorM String) -> (String -> String -> Maybe String) -> (String -> YiM [String]) -> String -> YiM String
simpleComplete :: (String -> YiM [String]) -> String -> YiM String
infixComplete :: (String -> YiM [String]) -> String -> YiM String
infixComplete' :: Bool -> (String -> YiM [String]) -> String -> YiM String
anyModeByName :: String -> YiM AnyMode
getAllModeNames :: YiM [String]

-- | Returns all the buffer names.
matchingBufferNames :: String -> YiM [String]
anyModeByNameM :: String -> YiM (Maybe AnyMode)
anyModeName :: AnyMode -> String

-- | Tag a type with a documentation
newtype (:::) t doc
Doc :: t -> ::: t doc
fromDoc :: ::: t doc -> t
data LineNumber
data RegexTag
data FilePatternTag
data ToKill
newtype CommandArguments
CommandArguments :: [String] -> CommandArguments
instance Typeable2 :::
instance Typeable RegexTag
instance Typeable FilePatternTag
instance Typeable CommandArguments
instance Eq t => Eq (t ::: doc)
instance Num t => Num (t ::: doc)
instance IsString t => IsString (t ::: doc)
instance Promptable CommandArguments
instance DocType FilePatternTag
instance DocType RegexTag
instance DocType ToKill
instance DocType LineNumber
instance (DocType doc, Promptable t) => Promptable (t ::: doc)
instance Show x => Show (x ::: t)
instance (YiAction a x, Promptable r) => YiAction (r -> a) x
instance Promptable BufferRef
instance Promptable AnyMode
instance Promptable Point
instance Promptable TextUnit
instance Promptable Direction
instance Promptable Int
instance Promptable Char
instance Promptable String


-- | Various high-level functions to further classify.
module Yi.Misc

-- | Given a possible starting path (which if not given defaults to the
--   current directory) and a fragment of a path we find all files within
--   the given (or current) directory which can complete the given path
--   fragment. We return a pair of both directory plus the filenames on
--   their own that is without their directories. The reason for this is
--   that if we return all of the filenames then we get a <tt>hint</tt>
--   which is way too long to be particularly useful.
getAppropriateFiles :: Maybe String -> String -> YiM (String, [String])

-- | Given a path, trim the file name bit if it exists. If no path given,
--   return current directory.
getFolder :: Maybe String -> IO String

-- | Given a possible path and a prefix, return matching file names.
matchingFileNames :: Maybe String -> String -> YiM [String]
adjBlock :: Int -> BufferM ()

-- | A simple wrapper to adjust the current indentation using the mode
--   specific indentation function but according to the given indent
--   behaviour.
adjIndent :: IndentBehaviour -> BufferM ()

-- | Generic emacs style prompt file action. Takes a <tt>prompt and a
--   continuation </tt>act and prompts the user with file hints
promptFile :: String -> (String -> YiM ()) -> YiM ()
matchFile :: String -> String -> Maybe String
completeFile :: String -> String -> YiM String

-- | For use as the hint when opening a file using the minibuffer. We
--   essentially return all the files in the given directory which have the
--   given prefix.
findFileHint :: String -> String -> YiM [String]
onCharLetterCode :: (Int -> Int) -> Char -> Char
rot13Char :: Char -> Char
printFileInfoE :: EditorM ()


-- | A Simple Dired Implementation for Yi
module Yi.Dired
dired :: YiM ()
diredDir :: FilePath -> YiM ()
diredDirBuffer :: FilePath -> YiM BufferRef
instance YiVariable DiredOpState
instance Binary DiredOpState
instance Typeable DiredOpState
instance Show DiredOpState
instance Eq DiredOpState
instance Initializable DiredOpState
instance Binary DiredFileInfo
instance Binary DiredEntry
instance YiVariable DiredState
instance Initializable DiredState
instance Binary DiredState
instance Typeable DiredFileInfo
instance Typeable DiredEntry
instance Typeable DiredState
instance Show DiredFileInfo
instance Eq DiredFileInfo
instance Show DiredEntry
instance Eq DiredEntry
instance Show DiredState
instance Eq DiredState

module Yi.File

-- | If file exists, read contents of file into a new buffer, otherwise
--   creating a new empty buffer. Replace the current window with a new
--   window onto the new buffer.
--   
--   If the file is already open, just switch to the corresponding buffer.
--   
--   Need to clean up semantics for when buffers exist, and how to attach
--   windows to buffers.
editFile :: FilePath -> YiM BufferRef

-- | Try to write a file in the manner of vi/vim Need to catch any
--   exception to avoid losing bindings
viWrite :: YiM ()

-- | Try to write to a named file in the manner of vi/vim
viWriteTo :: String -> YiM ()

-- | Try to write to a named file if it doesn't exist. Error out if it
--   does.
viSafeWriteTo :: String -> YiM ()

-- | Write current buffer to disk, if this buffer is associated with a file
fwriteE :: YiM ()

-- | Write a given buffer to disk if it is associated with a file.
fwriteBufferE :: BufferRef -> YiM ()

-- | Write all open buffers
fwriteAllE :: YiM ()

-- | Write current buffer to disk as <tt>f</tt>. The file is also set to
--   <tt>f</tt>
fwriteToE :: String -> YiM ()

-- | Make a backup copy of file
backupE :: FilePath -> YiM ()

-- | Revert to the contents of the file on disk
revertE :: YiM ()

-- | Associate buffer with file; canonicalize the given path name.
setFileName :: BufferRef -> FilePath -> YiM ()

module Yi.Keymap.Vim2.Operator
data VimOperator
VimOperator :: !OperatorName -> (Int -> StyledRegion -> EditorM RepeatToken) -> VimOperator
operatorName :: VimOperator -> !OperatorName
operatorApplyToRegionE :: VimOperator -> Int -> StyledRegion -> EditorM RepeatToken
defOperators :: [VimOperator]
opDelete :: VimOperator
opChange :: VimOperator
opYank :: VimOperator
opFormat :: VimOperator
stringToOperator :: [VimOperator] -> OperatorName -> Maybe VimOperator
mkCharTransformOperator :: OperatorName -> (Char -> Char) -> VimOperator
operatorApplyToTextObjectE :: VimOperator -> Int -> CountedTextObject -> EditorM RepeatToken
lastCharForOperator :: VimOperator -> String

module Yi.Keymap.Vim2.NormalOperatorPendingMap
defNormalOperatorPendingMap :: [VimOperator] -> [VimBinding]

module Yi.Keymap.Vim2.Ex.Commands.Common
parse :: GenParser Char () ExCommand -> String -> Maybe ExCommand
parseRange :: GenParser Char () LineRange
data OptionAction
Set :: !Bool -> OptionAction
Invert :: OptionAction
Ask :: OptionAction
parseOption :: String -> (OptionAction -> Action) -> String -> Maybe ExCommand
filenameComplete :: FilePath -> YiM [FilePath]
forAllBuffers :: MonadEditor m => (BufferRef -> m ()) -> m ()
pureExCommand :: ExCommand
impureExCommand :: ExCommand

module Yi.Keymap.Vim2.Ex.Commands.BufferDelete
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Delete
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Edit
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.GotoLine
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Nohl
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Paste
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Quit
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Reload
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Substitute
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Global
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex.Commands.Write
parse :: String -> Maybe ExCommand

module Yi.Modes
type TokenBasedMode tok = Mode (Tree (Tok tok))
fundamentalMode :: Mode syntax
cMode :: StyleBasedMode
objectiveCMode :: StyleBasedMode
cppMode :: StyleBasedMode
cabalMode :: StyleBasedMode
srmcMode :: StyleBasedMode
ocamlMode :: TokenBasedMode Token
ottMode :: StyleBasedMode
gnuMakeMode :: StyleBasedMode
perlMode :: StyleBasedMode
pythonMode :: StyleBasedMode
javaMode :: StyleBasedMode
jsonMode :: StyleBasedMode

-- | When applied to an extensions list, creates a <a>modeApplies</a>
--   function.
anyExtension :: [String] -> FilePath -> String -> Bool

-- | When applied to an extensions list and regular expression pattern,
--   creates a <a>modeApplies</a> function.
extensionOrContentsMatch :: [String] -> String -> FilePath -> String -> Bool
linearSyntaxMode :: Show lexerState => lexerState -> ((AlexState lexerState, AlexInput) -> Maybe (Tok t, (AlexState lexerState, AlexInput))) -> (t -> StyleName) -> Mode (Tree (Tok t))
svnCommitMode :: StyleBasedMode

-- | Adds a hook to all matching hooks in a list
hookModes :: (AnyMode -> Bool) -> BufferM () -> [AnyMode] -> [AnyMode]

-- | Apply a list of mode hooks to a list of AnyModes
applyModeHooks :: [(AnyMode -> Bool, BufferM ())] -> [AnyMode] -> [AnyMode]

-- | Check whether a mode of the same name is already in modeTable and
--   returns the original mode, if it isn't the case.
lookupMode :: AnyMode -> YiM AnyMode
whitespaceMode :: TokenBasedMode StyleName
removeAnnots :: Mode a -> Mode a
gitCommitMode :: Mode (Tree (Tok Token))
rubyMode :: StyleBasedMode


-- | A simple text mode; it does very little besides define a comment
--   syntax. We have it as a separate mode so users can bind the commands
--   to this mode specifically.
module Yi.Mode.IReader
abstract :: Mode syntax
ireaderMode :: Mode syntax
ireadMode :: YiM ()

module Yi.Mode.Compilation
mode :: Mode (Tree (Tok Token))

module Yi.Mode.Interactive
mode :: Mode (Tree (Tok Token))

-- | The GHCi prompt always begins with <a>&gt;</a>; this goes to just
--   before it, or if one is already at the start of the prompt, goes to
--   the beginning of the line. (If at the beginning of the line, this
--   pushes you forward to it.)
ghciHome :: BufferM ()
interactId :: String
interactHistoryMove :: Int -> EditorM ()
interactHistoryFinish :: EditorM ()
interactHistoryStart :: EditorM ()
getInputRegion :: BufferM Region
getInput :: BufferM String
setInput :: String -> BufferM ()

-- | Open a new buffer for interaction with a process.
interactive :: String -> [String] -> YiM BufferRef

-- | Send the type command to the process
feedCommand :: YiM ()

-- | Send command, recieve reply
queryReply :: BufferRef -> String -> YiM String


-- | Haskell-specific modes and commands.
module Yi.Mode.Haskell
haskellAbstract :: Mode (tree TT)

-- | <a>Clever</a> haskell mode, using the paren-matching syntax.
cleverMode :: Mode (Tree (Tok Token))

-- | Experimental Haskell mode, using a rather precise parser for the
--   syntax.
preciseMode :: Mode (Tree TT)
literateMode :: Mode (Tree TT)
fastMode :: Mode (Tree TT)

-- | Return GHCi's buffer; create it if necessary. Show it in another
--   window.
ghciGet :: YiM BufferRef

-- | Send a command to GHCi
ghciSend :: String -> YiM ()

-- | Load current buffer in GHCi
ghciLoadBuffer :: YiM ()
ghciInferType :: YiM ()
instance Typeable GhciBuffer
instance Initializable GhciBuffer
instance Binary GhciBuffer
instance YiVariable GhciBuffer


-- | Various high-level functions to further classify.
module Yi.Command

-- | Changing the buffer name quite useful if you have several the same.
--   This also breaks the relation with the file.
changeBufferNameE :: YiM ()

-- | shell-command with argument prompt
shellCommandE :: YiM ()

-- | shell-command with a known argument
shellCommandV :: String -> YiM ()
newtype CabalBuffer
CabalBuffer :: Maybe BufferRef -> CabalBuffer
cabalBuffer :: CabalBuffer -> Maybe BufferRef

-- | cabal-configure
cabalConfigureE :: CommandArguments -> YiM ()
configureExit :: Either SomeException ExitCode -> YiM ()
reloadProjectE :: String -> YiM ()

-- | Run the given commands with args and pipe the ouput into the build
--   buffer, which is shown in an other window.
buildRun :: String -> [String] -> (Either SomeException ExitCode -> YiM x) -> YiM ()
makeBuild :: CommandArguments -> YiM ()
cabalRun :: String -> (Either SomeException ExitCode -> YiM x) -> CommandArguments -> YiM ()

-- | cabal-build
cabalBuildE :: CommandArguments -> YiM ()
shell :: YiM BufferRef

-- | Search the source files in the project.
searchSources :: String ::: RegexTag -> YiM ()

-- | Perform a find+grep operation
grepFind :: String ::: FilePatternTag -> String ::: RegexTag -> YiM ()
instance Typeable CabalBuffer
instance Initializable CabalBuffer
instance Binary CabalBuffer
instance YiVariable CabalBuffer

module Yi.Mode.JavaScript
javaScriptMode :: Mode (Tree TT)

-- | Hooks for the JavaScript mode.
hooks :: Mode (Tree TT) -> Mode (Tree TT)
instance Typeable JSBuffer
instance Initializable JSBuffer
instance Binary JSBuffer
instance YiVariable JSBuffer

module Yi.Mode.Latex

-- | syntax-based latex mode
latexMode3 :: Mode (Tree TT)

-- | syntax-based latex mode
latexMode2 :: Mode (Tree TT)
fastMode :: Mode (Tree TT)

module Yi.Keymap.Vim2.NormalMap
defNormalMap :: [VimOperator] -> [VimBinding]

module Yi.Keymap.Vim2.VisualMap
defVisualMap :: [VimOperator] -> [VimBinding]

module Yi.UI.Batch

-- | Initialise the ui
start :: UIBoot


-- | exports from <a>Yi.Config.Simple</a> which are useful to "core yi"
--   rather than just config files.
module Yi.Config.Simple.Types

-- | The configuration monad. Run it with <tt>configMain</tt>.
newtype ConfigM a
ConfigM :: StateT Config IO a -> ConfigM a
runConfigM :: ConfigM a -> StateT Config IO a

-- | Fields that can be modified with (<a>%=</a>), <tt>get</tt> and
--   <tt>modify</tt>.
type Field a = Accessor Config a

-- | Accessor for any <a>YiConfigVariable</a>, to be used by modules
--   defining <a>YiConfigVariable</a>s. Such modules should provide a
--   custom-named field. For instance, take the following hypothetical
--   <a>YiConfigVariable</a>:
--   
--   <pre>
--   newtype UserName = UserName { unUserName :: String }
--     deriving(Typeable, Binary, Initializable)
--   instance YiConfigVariable UserName
--   
--   $(nameDeriveAccessors ''UserName (n -&gt; Just (n ++ "A")))
--   
--   userName :: <a>Field</a> <a>String</a>
--   userName = unUserNameA <a>.</a> <a>customVariable</a>
--   </pre>
--   
--   Here, the hypothetical library would provide the field
--   <tt>userName</tt> to be used in preference to <tt>customVariable</tt>.
customVariable :: YiConfigVariable a => Field a
instance Monad ConfigM
instance Functor ConfigM
instance Applicative ConfigM
instance MonadState Config ConfigM
instance MonadIO ConfigM


-- | This module implements persistence across different Yi runs. It
--   includes minibuffer command history, marks, VimTagStack etc. Warning:
--   Current version will _not_ check whether two or more instances of Yi
--   are run at the same time.
module Yi.PersistentState

-- | Loads a persistent state, and sets Yi state variables accordingly.
loadPersistentState :: YiM ()

-- | Here is a persistent history saving part. We assume each command is a
--   single line. To add new components, one has to:
--   
--   <ul>
--   <li>add new field in <tt>PersistentState</tt> structure, * add write
--   and read parts in
--   <tt>loadPersistentState</tt>/<tt>savePersistentState</tt>, * add a
--   trimming code in <tt>savePersistentState</tt> to prevent blowing up of
--   save file.</li>
--   </ul>
savePersistentState :: YiM ()
maxHistoryEntries :: Field Int
instance Typeable MaxHistoryEntries
instance Binary MaxHistoryEntries
instance YiConfigVariable MaxHistoryEntries
instance Initializable MaxHistoryEntries
instance Binary PersistentState


-- | This module provides assistance in implementing "hooks" in Yi. This
--   module provides no major new functionality -- only assistance in using
--   <a>YiConfigVariable</a>s more easily to implement hooks.
--   
--   We consider a simple example. Suppose we have a function
--   
--   <pre>
--   promptForFile :: Maybe FilePath -&gt; YiM FilePath
--   </pre>
--   
--   which prompts the user to select a file from their file system,
--   starting with the provided directory (if actually provided). Since
--   this is a frequent task in Yi, it is important for it to be as
--   user-friendly as possible. If opinions vary on the meaning of
--   "user-friendly", then we would really like to provide multiple
--   implementations of <tt>promptForFile</tt>, and allow users to select
--   which implementation to use in their config files.
--   
--   A way to achieve this is using hooks, as follows:
--   
--   <pre>
--   -- create a new type
--   newtype FilePrompter = FilePrompter { runFilePrompter :: Maybe FilePath -&gt; YiM FilePath }
--     deriving(Typeable)
--   $(nameDeriveAccessors ''FilePrompter (n -&gt; Just (n ++ "A")))
--   
--   -- give some implementations
--   filePrompter1, filePrompter2, filePrompter3 :: FilePrompter
--   ...
--   
--   -- declare FilePrompter as a YiConfigVariable (so it can go in the Config)
--   instance YiConfigVariable FilePrompter
--   
--   -- specify the default FilePrompter
--   instance Initializable FilePrompter where
--      initial = filePrompter1
--   
--   -- replace the old promptForFile function with a shim
--   promptForFile :: Maybe FilePath -&gt; YiM FilePath
--   promptForFile = runHook runFilePrompter
--   
--   -- provide a custom-named Field for Yi.Config.Simple (not strictly necessary, but user-friendly)
--   filePrompter :: Field FilePrompter
--   filePrompter = customVariable
--   </pre>
--   
--   The user can write
--   
--   <pre>
--   ...
--      filePrompter %= filePrompter2
--   ...
--   </pre>
--   
--   in their config file, and calls to <tt>promptForFile</tt> will now use
--   the different prompter. Library code which called
--   <tt>promptForFile</tt> does not need to be changed, but it gets the
--   new <tt>filePrompter2</tt> behaviour automatically.
--   
--   See <a>Yi.Eval</a> for a real example of hooks.
module Yi.Hooks

-- | Looks up the configured value for the hook, and runs it. The argument
--   to <a>runHook</a> will typically be a record accessor. See
--   <a>HookType</a> for the valid hook types.
runHook :: (HookType ty, YiConfigVariable var) => (var -> ty) -> ty

-- | The class of "valid hooks". This class is exported abstractly, but the
--   instances can be phrased quite simply: the functions (of arbitrarily
--   many arguments, including zero) which run in either the <a>EditorM</a>
--   or <a>YiM</a> monads.
--   
--   A typical example would be something like
--   
--   <tt>Int -&gt; String -&gt; <a>EditorM</a> String</tt>.
class HookType ty

-- | Accessor for any <a>YiConfigVariable</a>, to be used by modules
--   defining <a>YiConfigVariable</a>s. Such modules should provide a
--   custom-named field. For instance, take the following hypothetical
--   <a>YiConfigVariable</a>:
--   
--   <pre>
--   newtype UserName = UserName { unUserName :: String }
--     deriving(Typeable, Binary, Initializable)
--   instance YiConfigVariable UserName
--   
--   $(nameDeriveAccessors ''UserName (n -&gt; Just (n ++ "A")))
--   
--   userName :: <a>Field</a> <a>String</a>
--   userName = unUserNameA <a>.</a> <a>customVariable</a>
--   </pre>
--   
--   Here, the hypothetical library would provide the field
--   <tt>userName</tt> to be used in preference to <tt>customVariable</tt>.
customVariable :: YiConfigVariable a => Field a

-- | Fields that can be modified with (<a>%=</a>), <tt>get</tt> and
--   <tt>modify</tt>.
type Field a = Accessor Config a
instance HookType b => HookType (a -> b)
instance HookType (YiM a)
instance HookType (EditorM a)

module Yi.Eval

-- | Runs the action, as written by the user.
--   
--   The behaviour of this function can be customised by modifying the
--   <a>Evaluator</a> variable.
execEditorAction :: String -> YiM ()

-- | Lists the action names in scope, for use by <a>execEditorAction</a>.
--   
--   The behaviour of this function can be customised by modifying the
--   <a>Evaluator</a> variable.
getAllNamesInScope :: YiM [String]

-- | Config variable for customising the behaviour of
--   <a>execEditorAction</a> and <a>getAllNamesInScope</a>.
--   
--   Set this variable using <a>evaluator</a>. See <a>ghciEvaluator</a> and
--   <tt>finiteListEvaluator</tt> for two implementation.
data Evaluator
Evaluator :: (String -> YiM ()) -> YiM [String] -> Evaluator

-- | implementation of <a>execEditorAction</a>
execEditorActionImpl :: Evaluator -> String -> YiM ()

-- | implementation of <a>getAllNamesInScope</a>
getAllNamesInScopeImpl :: Evaluator -> YiM [String]

-- | The evaluator to use for <a>execEditorAction</a> and
--   <a>getAllNamesInScope</a>.
evaluator :: Field Evaluator

-- | Evaluator implemented by calling GHCi. This evaluator can run
--   arbitrary expressions in the class <a>YiAction</a>.
--   
--   The following two imports are always present:
--   
--   <pre>
--   import Yi
--   import qualified Yi.Keymap as Yi.Keymap
--   </pre>
--   
--   Also, if the file
--   
--   <pre>
--   $HOME/.config/yi/local/Env.hs
--   </pre>
--   
--   exists, it is imported unqualified.
ghciEvaluator :: Evaluator

-- | Evaluator based on a fixed list of published actions. Has a few
--   differences from <a>ghciEvaluator</a>:
--   
--   <ul>
--   <li>expressions can't be evaluated</li>
--   <li>all suggested actions are actually valued</li>
--   <li>(related to the above) doesn't contain junk actions from
--   Prelude</li>
--   <li>doesn't require GHCi backend, so uses less memory</li>
--   </ul>
publishedActionsEvaluator :: Evaluator

-- | Accessor for the published actions. Consider using
--   <a>publishAction</a>.
publishedActions :: Field (HashMap String Action)

-- | Publish the given action, by the given name. This will overwrite any
--   existing actions by the same name.
publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM ()
jumpToErrorE :: YiM ()
jumpToE :: String -> Int -> Int -> YiM ()
consoleKeymap :: Keymap
instance YiConfigVariable PublishedActions
instance Initializable PublishedActions
instance Typeable Evaluator
instance Typeable NamesCache
instance Typeable PublishedActions
instance Binary NamesCache
instance Monoid PublishedActions
instance YiVariable NamesCache
instance Initializable NamesCache
instance YiConfigVariable Evaluator
instance Initializable Evaluator

module Yi.Keymap.Emacs.Utils
type UnivArgument = Maybe Int

-- | Convert the universal argument to a number of repetitions
argToInt :: UnivArgument -> Int

-- | Quits the editor if there are no unmodified buffers if there are
--   unmodified buffers then we ask individually for each modified buffer
--   whether or not the user wishes to save it or not. If we get to the end
--   of this list and there are still some modified buffers then we ask
--   again if the user wishes to quit, but this is then a simple yes or no.
askQuitEditor :: YiM ()

-- | Quits the editor if there are no unmodified buffers if there are
--   unmodified buffers then we ask individually for each modified buffer
--   whether or not the user wishes to save it or not. If we get to the end
--   of this list and there are still some modified buffers then we ask
--   again if the user wishes to quit, but this is then a simple yes or no.
askSaveEditor :: YiM ()

-- | Quits the editor if there are no unmodified buffers if there are then
--   simply confirms with the user that they with to quit.
modifiedQuitEditor :: YiM ()

-- | <tt>withMinibuffer prompt completer act</tt>: open a minibuffer with
--   <tt>prompt</tt>. Once a string <tt>s</tt> is obtained, run <tt>act
--   s</tt>. <tt>completer</tt> can be used to complete functions: it
--   returns a list of possible matches.
withMinibuffer :: String -> (String -> YiM [String]) -> (String -> YiM ()) -> YiM ()
queryReplaceE :: YiM ()
isearchKeymap :: Direction -> Keymap

-- | cabal-configure
cabalConfigureE :: CommandArguments -> YiM ()

-- | cabal-build
cabalBuildE :: CommandArguments -> YiM ()
reloadProjectE :: String -> YiM ()
executeExtendedCommandE :: YiM ()
evalRegionE :: YiM ()
readUniversalArg :: KeymapM (Maybe Int)
scrollDownE :: UnivArgument -> BufferM ()
scrollUpE :: UnivArgument -> BufferM ()
switchBufferE :: YiM ()
killBufferE :: BufferRef ::: ToKill -> YiM ()

-- | Insert next character, <a>raw</a>
insertNextC :: UnivArgument -> KeymapM ()

-- | Open a file using the minibuffer. We have to set up some stuff to
--   allow hints and auto-completion.
findFile :: YiM ()

-- | Open a file in a new tab using the minibuffer.
findFileNewTab :: YiM ()

-- | Generic emacs style prompt file action. Takes a <tt>prompt and a
--   continuation </tt>act and prompts the user with file hints
promptFile :: String -> (String -> YiM ()) -> YiM ()

-- | Prompt the user to give a tag and then jump to that tag
promptTag :: YiM ()

-- | If on separators (space, tab, unicode seps), reduce multiple
--   separators to just a single separator.
justOneSep :: BufferM ()

-- | Join this line to previous (or next N if universal)
joinLinesE :: UnivArgument -> BufferM ()

module Yi.Keymap.Cua
keymap :: KeymapSet

-- | Introduce a keymap that is compatible with both windows and osx, by
--   parameterising the event modifier required for commands
portableKeymap :: (Event -> Event) -> KeymapSet
customizedCuaKeymapSet :: Keymap -> KeymapSet
cut :: EditorM ()
paste :: EditorM ()
copy :: EditorM ()
del :: EditorM ()

module Yi.Keymap.Vim2.Ex.Commands.Yi
parse :: String -> Maybe ExCommand

module Yi.Keymap.Vim2.Ex
exEvalE :: [String -> Maybe ExCommand] -> String -> EditorM ()
exEvalY :: [String -> Maybe ExCommand] -> String -> YiM ()
stringToExCommand :: [String -> Maybe ExCommand] -> String -> Maybe ExCommand
data ExCommand
ExCommand :: YiM [String] -> Bool -> Action -> Bool -> String -> ExCommand
cmdComplete :: ExCommand -> YiM [String]
cmdIsPure :: ExCommand -> Bool
cmdAction :: ExCommand -> Action
cmdAcceptsRange :: ExCommand -> Bool
cmdShow :: ExCommand -> String
defExCommandParsers :: [String -> Maybe ExCommand]

module Yi.Keymap.Vim2.ExMap
defExMap :: [String -> Maybe ExCommand] -> [VimBinding]


-- | This module aims at a mode that should be (mostly) intuitive to emacs
--   users, but mapping things into the Yi world when convenient. Hence, do
--   not go into the trouble of trying 100% emulation. For example, M-x
--   gives access to Yi (Haskell) functions, with their native names.
module Yi.Keymap.Emacs
keymap :: KeymapSet
mkKeymap :: Proto ModeMap -> KeymapSet
defKeymap :: Proto ModeMap
data ModeMap
ModeMap :: Keymap -> Bool -> ModeMap
eKeymap :: ModeMap -> Keymap
completionCaseSensitive :: ModeMap -> Bool


-- | Vim keymap for Yi. Emulates vim :set nocompatible
module Yi.Keymap.Vim
keymapSet :: KeymapSet

-- | Try to write a file in the manner of vi/vim Need to catch any
--   exception to avoid losing bindings
viWrite :: YiM ()
defKeymap :: Proto ModeMap
leaveInsRep :: VimMode

-- | Leave a mode. This always has priority over catch-all actions inside
--   the mode.
leave :: VimMode

-- | The Vim keymap is divided into several parts, roughly corresponding to
--   the different modes of vi. Each mode is in turn broken up into
--   separate VimProcs for each phase of key input in that mode.
data ModeMap
ModeMap :: VimMode -> VimMode -> VimOpts -> VimExCmdMap -> ModeMap

-- | Top level mode
v_top_level :: ModeMap -> VimMode

-- | vim insert mode
v_ins_char :: ModeMap -> VimMode
v_opts :: ModeMap -> VimOpts
v_ex_cmds :: ModeMap -> VimExCmdMap
data VimOpts
VimOpts :: Bool -> Bool -> Bool -> VimOpts
tildeop :: VimOpts -> Bool
completeCaseSensitive :: VimOpts -> Bool
enableTagStack :: VimOpts -> Bool
data VimExCmd
VimExCmd :: [String] -> (String -> YiM ()) -> Maybe (String -> YiM ()) -> VimExCmd
cmdNames :: VimExCmd -> [String]
cmdFn :: VimExCmd -> String -> YiM ()
completeFn :: VimExCmd -> Maybe (String -> YiM ())
nilCmd :: VimExCmd
exCmd :: String -> (String -> YiM ()) -> Maybe (String -> YiM ()) -> VimExCmd
exCmds :: [(String, String -> YiM (), Maybe (String -> YiM ()))] -> VimExCmdMap
exSimpleComplete :: (String -> YiM [String]) -> String -> YiM ()
exInfixComplete' :: Bool -> (String -> YiM [String]) -> String -> YiM ()
exInfixComplete :: (String -> YiM [String]) -> String -> YiM ()
mkExHistComplete :: (String -> String -> Bool) -> (String -> YiM [String]) -> String -> YiM ()
exHistComplete' :: Bool -> (String -> YiM [String]) -> String -> YiM ()
exHistComplete :: (String -> YiM [String]) -> String -> YiM ()
exHistInfixComplete' :: Bool -> (String -> YiM [String]) -> String -> YiM ()
exHistInfixComplete :: (String -> YiM [String]) -> String -> YiM ()

-- | The given buffer action should be an insertion action.
savingInsertB :: BufferM () -> BufferM ()
savingInsertCharB :: Char -> BufferM ()
savingInsertStringB :: String -> BufferM ()

-- | The given action should be a deletion action. The only well tested
--   buffer actions are deleting one character, or one word, forward or
--   backward.
savingDeleteB :: BufferM () -> BufferM ()
savingDeleteCharB :: Direction -> BufferM ()
savingDeleteWordB :: Direction -> BufferM ()
savingCommandY :: (Int -> YiM ()) -> Int -> YiM ()
savingCommandE :: (Int -> EditorM ()) -> Int -> EditorM ()
mkKeymap :: Proto ModeMap -> KeymapSet
beginIns :: (Show x, YiAction a x) => ModeMap -> a -> I Event Action ()
beginInsE :: ModeMap -> EditorM () -> I Event Action ()
beginInsB :: ModeMap -> BufferM () -> I Event Action ()
listTagStack :: EditorM [(FilePath, Point)]
pushTagStack :: FilePath -> Point -> EditorM ()
popTagStack :: Int -> EditorM (Maybe (FilePath, Point))
peekTagStack :: EditorM (Maybe (FilePath, Point))
exMode :: ModeMap -> String -> EditorM ()

-- | eval an ex command to an YiM (), also appends to the ex history
exEval :: ModeMap -> String -> YiM ()
instance Typeable ViMove
instance Typeable ViCmd
instance Typeable ViInsertion
instance Typeable MViInsertion
instance Initializable MViInsertion
instance YiVariable MViInsertion
instance Binary MViInsertion
instance YiVariable ViCmd
instance Initializable ViCmd
instance Binary ViCmd

module Yi.Mode.Abella
abellaModeVim :: TokenBasedMode Token
abellaModeEmacs :: TokenBasedMode Token

-- | Start Abella in a buffer
abella :: CommandArguments -> YiM BufferRef
abellaEval :: YiM ()
abellaEvalFromProofPoint :: YiM ()
abellaUndo :: YiM ()

-- | Return Abella's buffer; create it if necessary. Show it in another
--   window.
abellaGet :: YiM BufferRef

-- | Send a command to Abella
abellaSend :: String -> YiM ()
instance Typeable AbellaBuffer
instance Initializable AbellaBuffer
instance Binary AbellaBuffer
instance YiVariable AbellaBuffer

module Yi.Snippets
type SnippetCmd = RWST (Int, Int) [MarkInfo] () BufferM
data SnippetMark
SimpleMark :: !Int -> SnippetMark
ValuedMark :: !Int -> String -> SnippetMark
DependentMark :: !Int -> SnippetMark
data MarkInfo
SimpleMarkInfo :: !Int -> !Mark -> MarkInfo
userIndex :: MarkInfo -> !Int
startMark :: MarkInfo -> !Mark
ValuedMarkInfo :: !Int -> !Mark -> !Mark -> MarkInfo
userIndex :: MarkInfo -> !Int
startMark :: MarkInfo -> !Mark
endMark :: MarkInfo -> !Mark
DependentMarkInfo :: !Int -> !Mark -> !Mark -> MarkInfo
userIndex :: MarkInfo -> !Int
startMark :: MarkInfo -> !Mark
endMark :: MarkInfo -> !Mark
newtype BufferMarks
BufferMarks :: [MarkInfo] -> BufferMarks
bufferMarks :: BufferMarks -> [MarkInfo]
newtype DependentMarks
DependentMarks :: [[MarkInfo]] -> DependentMarks
marks :: DependentMarks -> [[MarkInfo]]
cursor :: Int -> SnippetMark
cursorWith :: Int -> String -> SnippetMark
dep :: Int -> SnippetMark
isDependentMark :: MarkInfo -> Bool
bufferMarkers :: MarkInfo -> [Mark]
class MkSnippetCmd a b | a -> b
mkSnippetCmd :: MkSnippetCmd a b => a -> SnippetCmd b
mkMark :: MonadTrans t => t BufferM Mark
text :: String -> SnippetCmd ()
(&) :: (MkSnippetCmd a any, MkSnippetCmd b c) => a -> b -> SnippetCmd c
(&>) :: (MkSnippetCmd a b, MkSnippetCmd c d) => a -> (b -> c) -> SnippetCmd d
runSnippet :: Bool -> SnippetCmd a -> BufferM a
updateUpdatedMarks :: [Update] -> BufferM ()
findEditedMarks :: [Update] -> BufferM [MarkInfo]
dependentSiblings :: MarkInfo -> [[MarkInfo]] -> [MarkInfo]
updateDependents :: MarkInfo -> BufferM ()
updateDependents' :: MarkInfo -> [[MarkInfo]] -> BufferM ()
markText :: MarkInfo -> BufferM String
setMarkText :: String -> MarkInfo -> BufferM ()
withSimpleRegion :: MarkInfo -> (Region -> BufferM Region) -> BufferM Region
markRegion :: MarkInfo -> BufferM Region
safeMarkRegion :: MarkInfo -> BufferM Region
adjMarkRegion :: MarkInfo -> BufferM Region
findOverlappingMarksWith :: (MarkInfo -> BufferM Region) -> ([[MarkInfo]] -> [MarkInfo]) -> Bool -> Region -> MarkInfo -> BufferM [MarkInfo]
findOverlappingMarks :: ([[MarkInfo]] -> [MarkInfo]) -> Bool -> Region -> MarkInfo -> BufferM [MarkInfo]
regionsOverlappingMarks :: Bool -> Region -> MarkInfo -> BufferM [MarkInfo]
overlappingMarks :: Bool -> Bool -> MarkInfo -> BufferM [MarkInfo]
allOverlappingMarks :: Bool -> MarkInfo -> BufferM [MarkInfo]
dependentOverlappingMarks :: Bool -> MarkInfo -> BufferM [MarkInfo]
nextBufferMark :: Bool -> BufferM (Maybe MarkInfo)
isDependentMarker :: MonadState FBuffer m => Mark -> m Bool
safeDeleteMarkB :: Mark -> BufferM ()
moveToNextBufferMark :: Bool -> BufferM ()
newtype SupertabExt
Supertab :: (String -> Maybe (BufferM ())) -> SupertabExt
superTab :: MonadInteract m Action Event => Bool -> SupertabExt -> m ()

-- | Convert snippet description list into a SuperTab extension
fromSnippets :: Bool -> [(String, SnippetCmd ())] -> SupertabExt
snippet :: MkSnippetCmd a b => a -> SnippetCmd b
instance Typeable BufferMarks
instance Typeable DependentMarks
instance Eq BufferMarks
instance Show BufferMarks
instance Monoid BufferMarks
instance Binary BufferMarks
instance Eq DependentMarks
instance Show DependentMarks
instance Monoid DependentMarks
instance Binary DependentMarks
instance Monoid SupertabExt
instance MkSnippetCmd SnippetMark ()
instance MkSnippetCmd (SnippetCmd a) a
instance MkSnippetCmd String ()
instance Ord MarkInfo
instance YiVariable DependentMarks
instance YiVariable BufferMarks
instance Initializable DependentMarks
instance Initializable BufferMarks
instance Binary MarkInfo
instance Eq MarkInfo
instance Show MarkInfo

module Yi.Snippets.Haskell
hsFunction :: SnippetCmd ()
hsClass :: SnippetCmd ()

module Yi.Keymap.Vim2
keymapSet :: KeymapSet
mkKeymapSet :: Proto VimConfig -> KeymapSet
defVimConfig :: Proto VimConfig
data VimBinding
VimBindingY :: (EventString -> VimState -> MatchResult ()) -> (EventString -> YiM RepeatToken) -> VimBinding
vbPrerequisite :: VimBinding -> EventString -> VimState -> MatchResult ()
vbyAction :: VimBinding -> EventString -> YiM RepeatToken
VimBindingE :: (EventString -> VimState -> MatchResult ()) -> (EventString -> EditorM RepeatToken) -> VimBinding
vbPrerequisite :: VimBinding -> EventString -> VimState -> MatchResult ()
vbeAction :: VimBinding -> EventString -> EditorM RepeatToken
data VimOperator
VimOperator :: !OperatorName -> (Int -> StyledRegion -> EditorM RepeatToken) -> VimOperator
operatorName :: VimOperator -> !OperatorName
operatorApplyToRegionE :: VimOperator -> Int -> StyledRegion -> EditorM RepeatToken
data VimConfig
VimConfig :: Keymap -> [VimBinding] -> [VimOperator] -> [String -> Maybe ExCommand] -> [(String, Char)] -> VimConfig
vimKeymap :: VimConfig -> Keymap
vimBindings :: VimConfig -> [VimBinding]
vimOperators :: VimConfig -> [VimOperator]
vimExCommandParsers :: VimConfig -> [String -> Maybe ExCommand]
vimDigraphs :: VimConfig -> [(String, Char)]
pureEval :: VimConfig -> String -> EditorM ()
impureEval :: VimConfig -> String -> YiM ()


-- | This module defines a user interface implemented using gtk2hs and
--   pango for direct text rendering.
module Yi.UI.Pango

-- | Initialise the ui
start :: UIBoot
instance Ord Modifier
instance Show WinInfo
instance Show TabInfo

module Yi.Config.Default
defaultConfig :: Config
availableFrontends :: [(String, UIBoot)]
defaultEmacsConfig :: Config
defaultVimConfig :: Config
defaultCuaConfig :: Config
toVimStyleConfig :: Config -> Config
toVim2StyleConfig :: Config -> Config
toEmacsStyleConfig :: Config -> Config
toCuaStyleConfig :: Config -> Config


-- | This is the main module of Yi, called with configuration from the
--   user. Here we mainly process command line arguments.
module Yi.Main

-- | Static main. This is the front end to the statically linked
--   application, and the real front end, in a sense. <tt>dynamic_main</tt>
--   calls this after setting preferences passed from the boot loader.
main :: (Config, ConsoleConfig) -> Maybe Editor -> IO ()

-- | Transform the config with options
do_args :: Config -> [String] -> Either Err (Config, ConsoleConfig)

-- | Configuration information which can be set in the command-line, but
--   not in the user's configuration file.
data ConsoleConfig
ConsoleConfig :: [String] -> Bool -> ConsoleConfig
ghcOptions :: ConsoleConfig -> [String]
selfCheck :: ConsoleConfig -> Bool
data Err
Err :: String -> ExitCode -> Err
instance Error Err


-- | Boot process of Yi. Uses Dyre to implement the XMonad-style dynamic
--   reconfiguration.
module Yi.Boot
yi :: Config -> IO ()

-- | Used by both the yi executable and the custom yi that is built from
--   the user's configuration. The yi executable uses a default config.
yiDriver :: Config -> IO ()

-- | <a>reloads</a> the configuration
--   
--   Serializes the editor state and relaunches Yi using the serialized
--   state. The launch of Yi will result in recompilation of the user's
--   custom yi. This, in effect, <a>reloads</a> the configuration.
reload :: YiM ()


-- | Facade of the Yi library, for use by confguration file. Just
--   re-exports a bunch of modules.
--   
--   You should therefore: import Yi in your ~<i>.config</i>yi/ scripts
module Yi

-- | A prototype. Typically the parameter will be a record type. Fields can
--   be defined in terms of others fields, with the idea that some of these
--   definitons can be overridden.
--   
--   Example:
--   
--   <pre>
--   data O = O {f1, f2, f3 :: Int}
--       deriving Show
--   o1 = Proto $ \self -&gt; O
--     {
--      f1 = 1,
--      f2 = f1 self + 1,  -- 'f1 self' refers to the overriden definition of f1.
--      f3 = f1 self + 2
--     }
--   </pre>
newtype Proto a
Proto :: (a -> a) -> Proto a
fromProto :: Proto a -> a -> a

-- | Get the value of a prototype. This can return bottom in case some
--   fields are recursively defined in terms of each other.
extractValue :: Proto t -> t

-- | Override a prototype. Fields can be defined in terms of their
--   definition in the base prototype.
--   
--   Example:
--   
--   <pre>
--   o2 = o1 `override` \super self -&gt; super 
--      {
--      f1 = f1 super + 10,
--      f3 = f3 super + 1
--      }
--   </pre>
override :: Proto a -> (a -> a -> a) -> Proto a

-- | Field access
(.->) :: Proto t -> (t -> a) -> a


-- | A simplified configuration interface for Yi.
module Yi.Config.Simple

-- | The configuration monad. Run it with <tt>configMain</tt>.
data ConfigM a

-- | Starts with the given initial config, makes the described
--   modifications, then starts yi.
configMain :: Config -> ConfigM () -> IO ()

-- | Fields that can be modified with (<a>%=</a>), <tt>get</tt> and
--   <tt>modify</tt>.
type Field a = Accessor Config a

-- | Set a field.
(%=) :: Field a -> a -> ConfigM ()

-- | Get a field.
get :: Field a -> ConfigM a

-- | Modify a field.
modify :: Field a -> (a -> a) -> ConfigM ()

-- | Sets the frontend to the first frontend from the list which is
--   installed.
--   
--   Available frontends are a subset of: "vte", "vty", "pango", "cocoa",
--   and "batch".
setFrontendPreferences :: [String] -> ConfigM ()

-- | Sets the frontend, if it is available.
setFrontend :: String -> ConfigM ()

-- | Adds the given key bindings to the `global keymap'. The bindings will
--   override existing bindings in the case of a clash.
globalBindKeys :: Keymap -> ConfigM ()

-- | <tt>modeBindKeys mode keys</tt> adds the keybindings in <tt>keys</tt>
--   to all modes with the same name as <tt>mode</tt>.
--   
--   As with <a>modifyMode</a>, a mode by the given name must already be
--   registered, or the function will have no effect, and issue a
--   command-line warning.
modeBindKeys :: Mode syntax -> Keymap -> ConfigM ()

-- | <tt>modeBindKeysByName name keys</tt> adds the keybindings in
--   <tt>keys</tt> to all modes with name <tt>name</tt> (if it is
--   registered). Consider using <a>modeBindKeys</a> instead.
modeBindKeysByName :: String -> Keymap -> ConfigM ()

-- | Register the given mode. It will be preferred over any modes already
--   defined.
addMode :: Mode syntax -> ConfigM ()

-- | <tt>modifyMode mode f</tt> modifies all modes with the same name as
--   <tt>mode</tt>, using the function <tt>f</tt>.
--   
--   Note that the <tt>mode</tt> argument is only used by its
--   <a>modeName</a>. In particular, a mode by the given name must already
--   be registered, or this function will have no effect, and issue a
--   command-line warning.
--   
--   <pre>
--   <a>modifyMode</a> mode f = <a>modifyModeByName</a> (<a>modeName</a> mode) f
--   </pre>
modifyMode :: Mode syntax -> (forall syntax'. Mode syntax' -> Mode syntax') -> ConfigM ()

-- | <tt>modifyModeByName name f</tt> modifies the mode with name
--   <tt>name</tt> using the function <tt>f</tt>. Consider using
--   <a>modifyMode</a> instead.
modifyModeByName :: String -> (forall syntax. Mode syntax -> Mode syntax) -> ConfigM ()

-- | The evaluator to use for <a>execEditorAction</a> and
--   <a>getAllNamesInScope</a>.
evaluator :: Field Evaluator

-- | Evaluator implemented by calling GHCi. This evaluator can run
--   arbitrary expressions in the class <a>YiAction</a>.
--   
--   The following two imports are always present:
--   
--   <pre>
--   import Yi
--   import qualified Yi.Keymap as Yi.Keymap
--   </pre>
--   
--   Also, if the file
--   
--   <pre>
--   $HOME/.config/yi/local/Env.hs
--   </pre>
--   
--   exists, it is imported unqualified.
ghciEvaluator :: Evaluator

-- | Evaluator based on a fixed list of published actions. Has a few
--   differences from <a>ghciEvaluator</a>:
--   
--   <ul>
--   <li>expressions can't be evaluated</li>
--   <li>all suggested actions are actually valued</li>
--   <li>(related to the above) doesn't contain junk actions from
--   Prelude</li>
--   <li>doesn't require GHCi backend, so uses less memory</li>
--   </ul>
publishedActionsEvaluator :: Evaluator

-- | Publish the given action, by the given name. This will overwrite any
--   existing actions by the same name.
publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM ()

-- | Accessor for the published actions. Consider using
--   <a>publishAction</a>.
publishedActions :: Field (HashMap String Action)

-- | <a>Just</a> the font name, or <a>Nothing</a> for default.
fontName :: Field (Maybe String)

-- | <a>Just</a> the font size, or <a>Nothing</a> for default.
fontSize :: Field (Maybe Int)

-- | Amount to move the buffer when using the scroll wheel.
scrollWheelAmount :: Field Int

-- | <a>Just</a> the scroll style, or <a>Nothing</a> for default.
scrollStyle :: Field (Maybe ScrollStyle)
data ScrollStyle
SnapToCenter :: ScrollStyle
SingleLine :: ScrollStyle

-- | See <a>CursorStyle</a> for documentation.
cursorStyle :: Field CursorStyle

-- | When should we use a "fat" cursor (i.e. 2 pixels wide, rather than 1)?
--   Fat cursors have only been implemented for the Pango frontend.
data CursorStyle
AlwaysFat :: CursorStyle
NeverFat :: CursorStyle
FatWhenFocused :: CursorStyle
FatWhenFocusedAndInserting :: CursorStyle
data Side
LeftSide :: Side
RightSide :: Side

-- | Which side to display the scroll bar on.
scrollBarSide :: Field Side

-- | Should the scroll bar autohide?
autoHideScrollBar :: Field Bool

-- | Should the tab bar autohide?
autoHideTabBar :: Field Bool

-- | Should lines be wrapped?
lineWrap :: Field Bool

-- | The character with which to fill empty window space. Usually '~' for
--   vi-like editors, ' ' for everything else.
windowFill :: Field Char

-- | UI colour theme.
theme :: Field Theme

-- | List of registered layout managers. When cycling through layouts, this
--   list will be consulted.
layoutManagers :: Field [AnyLayoutManager]

-- | Produce a .yi.dbg file with debugging information?
debug :: Field Bool

-- | Run when the editor is started (this is run after all actions which
--   have already been registered)
runOnStartup :: Action -> ConfigM ()

-- | Run after the startup actions have completed, or on reload (this is
--   run after all actions which have already been registered)
runAfterStartup :: Action -> ConfigM ()

-- | Actions to run when the editor is started. Consider using
--   <a>runOnStartup</a> or <a>runManyOnStartup</a> instead.
startActions :: Field [Action]

-- | Actions to run after startup or reload. Consider using
--   <a>runAfterStartup</a> or <a>runManyAfterStartup</a> instead.
initialActions :: Field [Action]

-- | Default keymap to use.
defaultKm :: Field KeymapSet

-- | ?
inputPreprocess :: Field (P Event Event)

-- | List of modes by order of preference. Consider using <a>addMode</a>,
--   <a>modeBindKeys</a>, or <a>modifyMode</a> instead.
modes :: Field [AnyMode]

-- | Set to <a>Exclusive</a> for an emacs-like behaviour. Consider starting
--   with <a>defaultEmacsConfig</a>, <a>defaultVimConfig</a>, or
--   <a>defaultCuaConfig</a> to instead.
regionStyle :: Field RegionStyle

-- | Set to <a>True</a> for an emacs-like behaviour, where all deleted text
--   is accumulated in a killring. Consider starting with
--   <a>defaultEmacsConfig</a>, <a>defaultVimConfig</a>, or
--   <a>defaultCuaConfig</a> instead.
killringAccumulate :: Field Bool

-- | ?
bufferUpdateHandler :: Field [[Update] -> BufferM ()]
