-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A modular text editor
--
-- A modular text editor This is only a snippet, see the project's
-- README.
--
-- Rasa is a text editor project with a few interesting goals. For better
-- or worse it attempts to be as modular as possible. This means that
-- most functionality which would typically be considered to be
-- core in other editors is implemented as extensions in Rasa.
-- This approach comes with its own share of pros and cons, for instance:
--
-- Pros
--
--
-- - Implementing most core functionality as extensions ensures a
-- powerful and elegant extension interface.
-- - Flexibility; don't like the default cursor implementation? Write
-- your own!
-- - Adaptability; the core of Rasa is miniscule, you can mix and match
-- extensions to build any editor you want.
--
--
-- Cons
--
--
-- - Module cross-dependencies makes the community infrastructure more
-- fragile; We'll likely have to develop a solution to this as a
-- community as time goes on.
-- - Fragmentation; Not having a single implementation for a given
-- feature means extensions that depend on a feature have to pick a
-- specific implementation to augment. Over time data-structures and
-- types will be standardized into Rasa's core to help alleviate
-- this.
--
--
-- While highly experimental, I've found the current API to be quite
-- expressive and adaptable; for instance I was able to implement the
-- notion of multiple cursors using the extension API in less than a day.
-- I hope to keep the learning curve low as development continues.
--
-- Getting Started
--
-- First clone the Github repo and try running the example-config
-- included there. Once you get it running (see the README) then
-- you can customize your keymap to add a few mappings you like. Then I'd
-- check out the Building your own extensions guide. It goes in
-- depth into everything you'd want to know!
--
-- If you have any issues (and I'm sure there'll be a few; it's a new
-- project!) please report them here and we'll talk about it!
@package rasa
@version 0.1.3
module Rasa.Internal.Text
-- | An iso which converts to/from YiString -> Text
asText :: Iso' YiString Text
-- | An iso which converts to/from YiString -> String
asString :: Iso' YiString String
-- | An iso which converts to/from YiString -> [YiString]
asLines :: Iso' YiString [YiString]
module Rasa.Internal.Range
-- | (Coord Row Column) represents a char in a block of text. (zero
-- indexed) e.g. Coord 0 0 is the first character in the text, Coord 2 1
-- is the second character of the third row
data Coord
Coord :: Int -> Int -> Coord
-- | An Offset represents an exact position in a file as a number of
-- characters from the start.
newtype Offset
Offset :: Int -> Offset
-- | Given the text you're operating over, creates an iso from an
-- Offset to a Coord.
asCoord :: YiString -> Iso' Offset Coord
-- | This will restrict a given Coord to a valid one which lies
-- within the given text.
clampCoord :: YiString -> Coord -> Coord
-- | This will restrict a given Range to a valid one which lies
-- within the given text.
clampRange :: YiString -> Range -> Range
-- | This represents a range between two coordinates (Coord)
data Range
Range :: Coord -> Coord -> Range
-- | Returns the number of rows and columns that a chunk of text spans as a
-- Coord
sizeOf :: YiString -> Coord
-- | Returns the number of rows and columns that a Range spans as a
-- Coord
sizeOfR :: Range -> Coord
-- | Moves a Range by a given Coord It may be unintuitive,
-- but for (Coord row col) a given range will be moved down by row and to
-- the right by col.
moveRange :: Coord -> Range -> Range
-- | Moves a range forward by the given amount
moveRangeByN :: Int -> Range -> Range
-- | Moves a Coord forward by the given amount of columns
moveCursorByN :: Int -> Coord -> Coord
-- | Adds the rows and columns of the given two Coords.
moveCursor :: Coord -> Coord -> Coord
-- | A span which maps a piece of Monoidal data over a range.
data Span a
Span :: Range -> a -> Span a
[_getRange] :: Span a -> Range
[_data] :: Span a -> a
-- | Combines a list of spans containing some monoidal data into a list of
-- offsets with with the data that applies from each Offset forwards.
combineSpans :: forall a. Monoid a => [Span a] -> [(Coord, a)]
-- | clamp min max val restricts val to be within min and max
-- (inclusive)
clamp :: Int -> Int -> Int -> Int
-- | A lens over text before a given Coord
beforeC :: Coord -> Lens' YiString YiString
-- | A lens over text after a given Coord
afterC :: Coord -> Lens' YiString YiString
instance GHC.Classes.Eq Rasa.Internal.Range.Marker
instance GHC.Show.Show Rasa.Internal.Range.Marker
instance GHC.Base.Functor Rasa.Internal.Range.Span
instance GHC.Classes.Eq a => GHC.Classes.Eq (Rasa.Internal.Range.Span a)
instance GHC.Show.Show a => GHC.Show.Show (Rasa.Internal.Range.Span a)
instance GHC.Classes.Eq Rasa.Internal.Range.Offset
instance GHC.Show.Show Rasa.Internal.Range.Offset
instance GHC.Classes.Eq Rasa.Internal.Range.Range
instance GHC.Show.Show Rasa.Internal.Range.Range
instance GHC.Classes.Eq Rasa.Internal.Range.Coord
instance GHC.Show.Show Rasa.Internal.Range.Coord
instance GHC.Classes.Ord Rasa.Internal.Range.Range
instance GHC.Classes.Ord Rasa.Internal.Range.Coord
instance GHC.Num.Num Rasa.Internal.Range.Coord
module Rasa.Internal.Extensions
-- | A wrapper around an extension of any type so it can be stored in an
-- ExtMap
data Ext
Ext :: a -> Ext
-- | A map of extension types to their current value.
type ExtMap = Map TypeRep Ext
instance GHC.Show.Show Rasa.Internal.Extensions.Ext
module Rasa.Internal.Events
-- | The Event type represents a common denominator for all actions that
-- could occur Event transmitters express events that have occured as a
-- member of this type. At the moment it's quite sparse, but it will
-- expand as new types of events are needed.
--
-- This event is dispatched exactly once when the editor starts up.
data Init
Init :: Init
-- | This event is dispatched immediately before dispatching any events
-- from asyncronous event listeners (like Keypresss)
data BeforeEvent
BeforeEvent :: BeforeEvent
-- | This event is dispatched immediately before dispatching the
-- OnRender event.
data BeforeRender
BeforeRender :: BeforeRender
-- | This event is dispatched when it's time for extensions to render to
-- screen.
data OnRender
OnRender :: OnRender
-- | This event is dispatched immediately after dispatching
-- OnRender.
data AfterRender
AfterRender :: AfterRender
-- | This event is dispatched before exiting the editor, listen for this to
-- do any clean-up (saving files, etc.)
data Exit
Exit :: Exit
-- | This event is dispatched in response to keyboard key presses. It
-- contains both the char that was pressed and any modifiers (Mod)
-- that where held when the key was pressed.
data Keypress
Keypress :: Char -> [Mod] -> Keypress
Esc :: Keypress
BS :: Keypress
Enter :: Keypress
-- | This represents each modifier key that could be pressed along with a
-- key.
data Mod
Ctrl :: Mod
Alt :: Mod
Shift :: Mod
instance GHC.Classes.Eq Rasa.Internal.Events.Keypress
instance GHC.Show.Show Rasa.Internal.Events.Keypress
instance GHC.Classes.Eq Rasa.Internal.Events.Mod
instance GHC.Show.Show Rasa.Internal.Events.Mod
instance GHC.Classes.Eq Rasa.Internal.Events.Exit
instance GHC.Show.Show Rasa.Internal.Events.Exit
instance GHC.Classes.Eq Rasa.Internal.Events.AfterRender
instance GHC.Show.Show Rasa.Internal.Events.AfterRender
instance GHC.Classes.Eq Rasa.Internal.Events.OnRender
instance GHC.Show.Show Rasa.Internal.Events.OnRender
instance GHC.Classes.Eq Rasa.Internal.Events.BeforeRender
instance GHC.Show.Show Rasa.Internal.Events.BeforeRender
instance GHC.Classes.Eq Rasa.Internal.Events.BeforeEvent
instance GHC.Show.Show Rasa.Internal.Events.BeforeEvent
instance GHC.Classes.Eq Rasa.Internal.Events.Init
instance GHC.Show.Show Rasa.Internal.Events.Init
module Rasa.Internal.Buffer
-- | A buffer, holds the text in the buffer and any extension states that
-- are set on the buffer. A buffer is the State of the BufAction
-- monad transformer stack, so the type may be useful in defining lenses
-- over your extension states.
data Buffer
-- | A wrapper around an extension of any type so it can be stored in an
-- ExtMap
data Ext
Ext :: a -> Ext
bufExts :: Lens' Buffer ExtMap
-- | A lens into the text of the given buffer. Use within a BufAction.
text :: Lens' Buffer Text
rope :: Lens' Buffer YiString
-- | Creates a new buffer from the givven text.
newBuffer :: Text -> Buffer
instance GHC.Show.Show Rasa.Internal.Buffer.Buffer
module Rasa.Internal.Editor
-- | This is the primary state of the editor.
data Editor
focused :: Lens' Editor Int
buffers :: Lens' Editor [Buffer]
exiting :: Lens' Editor Bool
-- | ext is a lens which will focus the extension state that matches
-- the type inferred as the focal point. It's a little bit of magic, if
-- you treat the focus as a member of your extension state it should just
-- work out.
--
-- This lens falls back on the extension's Default instance (when
-- getting) if nothing has yet been stored.
ext :: forall a. (Show a, Typeable a, Default a) => Lens' Editor a
-- | A lens over the extensions of all buffers. This is useful for setting
-- defaults or altering extension state across all buffers.
allBufExt :: forall a. (Show a, Typeable a) => Traversal' Editor (Maybe a)
-- | bufExt is a lens which will focus a given extension's state
-- within a buffer (within a BufAction). The lens will
-- automagically focus the required extension by using type inference.
-- It's a little bit of magic, if you treat the focus as a member of your
-- extension state it should just work out.
--
-- This lens falls back on the extension's Default instance (when
-- getting) if nothing has yet been stored.
bufExt :: forall a. (Show a, Typeable a, Default a) => Lens' Buffer a
-- | focusedBuf is a lens which focuses the currently selected
-- buffer.
focusedBuf :: Lens' Editor Buffer
-- | A lens over text which is encompassed by a Range
range :: Range -> Lens' Buffer YiString
instance GHC.Show.Show Rasa.Internal.Editor.Editor
instance Data.Default.Class.Default Rasa.Internal.Editor.Editor
module Rasa.Internal.Action
-- | This is a monad-transformer stack for performing actions against the
-- editor. You register Actions to be run in response to events using
-- eventListener
--
-- Within an Action you can:
--
--
-- - Use liftIO for IO
-- - Access/edit extensions that are stored globally, see
-- ext
-- - Embed any Actions exported other extensions
-- - Embed buffer actions using bufDo and focusDo
-- - Add/Edit/Focus buffers and a few other Editor-level things, see
-- the Directive module.
--
newtype Action a
Action :: StateT Editor (ReaderT Hooks IO) a -> Action a
[runAct] :: Action a -> StateT Editor (ReaderT Hooks IO) a
-- | Unwrap and execute an Action (returning the editor state)
execAction :: Editor -> Hooks -> Action () -> IO Editor
-- | Unwrap and evaluate an Action (returning the value)
evalAction :: Editor -> Hooks -> Action a -> IO a
-- | This is a monad-transformer stack for performing actions on a specific
-- buffer. You register BufActions to be run by embedding them in a
-- scheduled Action via bufferDo or focusDo
--
-- Within a BufAction you can:
--
--
-- - Use liftIO for IO
-- - Access/edit buffer extensions; see bufExt
-- - Embed and sequence any BufActions from other
-- extensions
-- - Access/Edit the buffer's text
--
newtype BufAction a
BufAction :: StateT Buffer (ReaderT Hooks IO) a -> BufAction a
[getBufAction] :: BufAction a -> StateT Buffer (ReaderT Hooks IO) a
-- | A wrapper around event listeners so they can be stored in
-- Hooks.
data Hook
Hook :: a -> Hook
-- | A map of Event types to a list of listeners for that event
type Hooks = Map TypeRep [Hook]
instance Control.Monad.IO.Class.MonadIO Rasa.Internal.Action.Action
instance Control.Monad.Reader.Class.MonadReader Rasa.Internal.Action.Hooks Rasa.Internal.Action.Action
instance Control.Monad.State.Class.MonadState Rasa.Internal.Editor.Editor Rasa.Internal.Action.Action
instance GHC.Base.Monad Rasa.Internal.Action.Action
instance GHC.Base.Applicative Rasa.Internal.Action.Action
instance GHC.Base.Functor Rasa.Internal.Action.Action
instance Control.Monad.IO.Class.MonadIO Rasa.Internal.Action.BufAction
instance Control.Monad.Reader.Class.MonadReader Rasa.Internal.Action.Hooks Rasa.Internal.Action.BufAction
instance Control.Monad.State.Class.MonadState Rasa.Internal.Buffer.Buffer Rasa.Internal.Action.BufAction
instance GHC.Base.Monad Rasa.Internal.Action.BufAction
instance GHC.Base.Applicative Rasa.Internal.Action.BufAction
instance GHC.Base.Functor Rasa.Internal.Action.BufAction
module Rasa.Internal.Directive
-- | This lifts a BufAction to an Action which performs the
-- BufAction on every buffer and collects the return values via
-- mappend
bufDo :: Monoid a => BufAction a -> Action a
-- | This lifts a BufAction to an Action which performs the
-- BufAction on the focused buffer.
focusDo :: BufAction a -> Action a
-- | This signals to the editor that you'd like to shutdown. The current
-- events will finish processing, then the onExit hook will run,
-- then the editor will exit.
exit :: Action ()
-- | This adds a new buffer with the given text.
addBuffer :: Text -> Action ()
-- | This adds a new buffer with the given text then performs the given
-- BufAction agains that buffer.
addBufferThen :: Text -> BufAction a -> Action a
-- | Switches focus to the next buffer
nextBuf :: Action ()
-- | Switches focus to the previous buffer
prevBuf :: Action ()
-- | Runs the given function over the text in the range, replacing it with
-- the results.
overRange :: Range -> (Text -> Text) -> BufAction ()
-- | Replaces the text in the given range from the buffer.
replaceRange :: Range -> Text -> BufAction ()
-- | Deletes the text in the given range from the buffer.
deleteRange :: Range -> BufAction ()
-- | Inserts text into the buffer at the given Coord.
insertAt :: Coord -> Text -> BufAction ()
-- | Returns the number of rows and columns that a chunk of text spans as a
-- Coord
sizeOf :: YiString -> Coord
module Rasa.Internal.Scheduler
-- | The Scheduler is how you can register your extension's actions to run
-- at different points in the editor's event cycle.
--
-- The event cycle proceeds as follows:
--
--
-- Init (Runs ONCE)
--
-- -- The following loops until an exit is triggered:
-- BeforeEvent -> (any event) -> BeforeRender -> OnRender -> AfterRender
--
-- Exit (Runs ONCE)
--
--
-- Each extension which wishes to perform actions exports a
-- Scheduler () which the user inserts in their config
-- file.
newtype Scheduler a
Scheduler :: State Hooks a -> Scheduler a
[runSched] :: Scheduler a -> State Hooks a
-- | A wrapper around event listeners so they can be stored in
-- Hooks.
data Hook
-- | A map of Event types to a list of listeners for that event
type Hooks = Map TypeRep [Hook]
-- | Registers an action to be performed AFTER each render phase.
--
-- This is useful for cleaning up extension state that was registered for
-- the renderer, but needs to be cleared before the next iteration.
afterRender :: Action () -> Scheduler ()
-- | Registers an action to be performed BEFORE each event phase.
beforeEvent :: Action () -> Scheduler ()
-- | Registers an action to be performed BEFORE each render phase.
--
-- This is a good spot to add information useful to the renderer since
-- all actions have been performed. Only cosmetic changes should occur
-- during this phase.
beforeRender :: Action () -> Scheduler ()
-- | Use this to dispatch an event of any type, any hooks which are
-- listening for this event will be triggered with the provided event.
-- Use this within an Action.
dispatchEvent :: Typeable a => a -> Action ()
-- | This registers an event listener hook, as long as the listener is
-- well-typed similar to this:
--
-- MyEventType -> Action () then it will be registered to
-- listen for dispatched events of that type. Use within the
-- Scheduler and add have the user add it to their config.
eventListener :: forall a. Typeable a => (a -> Action ()) -> Scheduler ()
-- | Transform a Scheduler monad into a Hooks map.
getHooks :: Scheduler () -> Hooks
-- | This extracts all event listener hooks from a map of hooks which match
-- the type of the provided event.
matchingHooks :: forall a. Typeable a => Hooks -> [a -> Action ()]
-- | Registers an action to be performed during the exit phase.
--
-- This is only triggered exactly once when the editor is shutting down.
-- It allows an opportunity to do clean-up, kill any processes you've
-- started, or save any data before the editor terminates.
onExit :: Action () -> Scheduler ()
-- | Registers an action to be performed during the Initialization phase.
--
-- This phase occurs exactly ONCE when the editor starts up.
onInit :: Action () -> Scheduler ()
-- | Registers an action to be performed during each render phase.
--
-- This phase should only be used by extensions which actually render
-- something.
onRender :: Action () -> Scheduler ()
instance Control.Monad.State.Class.MonadState Rasa.Internal.Action.Hooks Rasa.Internal.Scheduler.Scheduler
instance GHC.Base.Monad Rasa.Internal.Scheduler.Scheduler
instance GHC.Base.Applicative Rasa.Internal.Scheduler.Scheduler
instance GHC.Base.Functor Rasa.Internal.Scheduler.Scheduler
-- | This module contains the public API for building an extension for
-- Rasa. It re-exports the parts of rasa that are public API for creating
-- extensions.
--
-- There are two main things that an extension can do, either react to
-- editor events, or expose useful actions and/or state for other
-- extensions to use.
--
-- To react to events an extension defines a Scheduler which the
-- user puts in their config file. The Scheduler defines listeners
-- for events which the extension will react to. See Scheduler for
-- more detailed information.
--
-- Whether performing its own actions or being used by a different
-- extension an extension will want to define some Actions to
-- perform. Actions can operate over buffers or even perform IO and
-- comprise the main way in which extensons do what they need to do. Read
-- more here: Action, BufAction.
--
-- To sum it all up, Here's an example of a simple logging extension that
-- simply writes each keypress to a file.
--
--
-- logKeypress :: Keypress -> Action ()
-- logKeypress (Keypress char _) = liftIO $ appendFile "logs" ("You pressed " ++ [char] ++ "\n")
--
-- logger :: Scheduler ()
-- logger = do
-- onInit $ liftIO $ writeFile "logs" "==Logs==\n"
-- eventListener logKeypress
-- onExit $ liftIO $ appendFile "logs" "==Done=="
--
--
-- Check out this tutorial on building extensions, it's also just a great
-- way to learn how the editor works:
-- <https://github.com/ChrisPenner/rasa/blob/master/docs/Building-An-Extension.md
-- Building an Extension>.
module Rasa.Ext
-- | This is a monad-transformer stack for performing actions against the
-- editor. You register Actions to be run in response to events using
-- eventListener
--
-- Within an Action you can:
--
--
-- - Use liftIO for IO
-- - Access/edit extensions that are stored globally, see
-- ext
-- - Embed any Actions exported other extensions
-- - Embed buffer actions using bufDo and focusDo
-- - Add/Edit/Focus buffers and a few other Editor-level things, see
-- the Directive module.
--
data Action a
-- | This signals to the editor that you'd like to shutdown. The current
-- events will finish processing, then the onExit hook will run,
-- then the editor will exit.
exit :: Action ()
-- | This adds a new buffer with the given text.
addBuffer :: Text -> Action ()
-- | This adds a new buffer with the given text then performs the given
-- BufAction agains that buffer.
addBufferThen :: Text -> BufAction a -> Action a
-- | Switches focus to the next buffer
nextBuf :: Action ()
-- | Switches focus to the previous buffer
prevBuf :: Action ()
-- | This is a monad-transformer stack for performing actions on a specific
-- buffer. You register BufActions to be run by embedding them in a
-- scheduled Action via bufferDo or focusDo
--
-- Within a BufAction you can:
--
--
-- - Use liftIO for IO
-- - Access/edit buffer extensions; see bufExt
-- - Embed and sequence any BufActions from other
-- extensions
-- - Access/Edit the buffer's text
--
data BufAction a
-- | This lifts a BufAction to an Action which performs the
-- BufAction on every buffer and collects the return values via
-- mappend
bufDo :: Monoid a => BufAction a -> Action a
-- | This lifts a BufAction to an Action which performs the
-- BufAction on the focused buffer.
focusDo :: BufAction a -> Action a
-- | Runs the given function over the text in the range, replacing it with
-- the results.
overRange :: Range -> (Text -> Text) -> BufAction ()
-- | Replaces the text in the given range from the buffer.
replaceRange :: Range -> Text -> BufAction ()
-- | Deletes the text in the given range from the buffer.
deleteRange :: Range -> BufAction ()
-- | Inserts text into the buffer at the given Coord.
insertAt :: Coord -> Text -> BufAction ()
-- | Returns the number of rows and columns that a chunk of text spans as a
-- Coord
sizeOf :: YiString -> Coord
-- | ext is a lens which will focus the extension state that matches
-- the type inferred as the focal point. It's a little bit of magic, if
-- you treat the focus as a member of your extension state it should just
-- work out.
--
-- This lens falls back on the extension's Default instance (when
-- getting) if nothing has yet been stored.
ext :: forall a. (Show a, Typeable a, Default a) => Lens' Editor a
-- | bufExt is a lens which will focus a given extension's state
-- within a buffer (within a BufAction). The lens will
-- automagically focus the required extension by using type inference.
-- It's a little bit of magic, if you treat the focus as a member of your
-- extension state it should just work out.
--
-- This lens falls back on the extension's Default instance (when
-- getting) if nothing has yet been stored.
bufExt :: forall a. (Show a, Typeable a, Default a) => Lens' Buffer a
-- | A buffer, holds the text in the buffer and any extension states that
-- are set on the buffer. A buffer is the State of the BufAction
-- monad transformer stack, so the type may be useful in defining lenses
-- over your extension states.
data Buffer
-- | A lens into the text of the given buffer. Use within a BufAction.
text :: Lens' Buffer Text
exiting :: Lens' Editor Bool
-- | This event is dispatched in response to keyboard key presses. It
-- contains both the char that was pressed and any modifiers (Mod)
-- that where held when the key was pressed.
data Keypress
Keypress :: Char -> [Mod] -> Keypress
Esc :: Keypress
BS :: Keypress
Enter :: Keypress
-- | This represents each modifier key that could be pressed along with a
-- key.
data Mod
Ctrl :: Mod
Alt :: Mod
Shift :: Mod
-- | The Scheduler is how you can register your extension's actions to run
-- at different points in the editor's event cycle.
--
-- The event cycle proceeds as follows:
--
--
-- Init (Runs ONCE)
--
-- -- The following loops until an exit is triggered:
-- BeforeEvent -> (any event) -> BeforeRender -> OnRender -> AfterRender
--
-- Exit (Runs ONCE)
--
--
-- Each extension which wishes to perform actions exports a
-- Scheduler () which the user inserts in their config
-- file.
data Scheduler a
-- | A map of Event types to a list of listeners for that event
type Hooks = Map TypeRep [Hook]
-- | A wrapper around event listeners so they can be stored in
-- Hooks.
data Hook
-- | Use this to dispatch an event of any type, any hooks which are
-- listening for this event will be triggered with the provided event.
-- Use this within an Action.
dispatchEvent :: Typeable a => a -> Action ()
-- | This registers an event listener hook, as long as the listener is
-- well-typed similar to this:
--
-- MyEventType -> Action () then it will be registered to
-- listen for dispatched events of that type. Use within the
-- Scheduler and add have the user add it to their config.
eventListener :: forall a. Typeable a => (a -> Action ()) -> Scheduler ()
-- | Registers an action to be performed during the Initialization phase.
--
-- This phase occurs exactly ONCE when the editor starts up.
onInit :: Action () -> Scheduler ()
-- | Registers an action to be performed BEFORE each event phase.
beforeEvent :: Action () -> Scheduler ()
-- | Registers an action to be performed BEFORE each render phase.
--
-- This is a good spot to add information useful to the renderer since
-- all actions have been performed. Only cosmetic changes should occur
-- during this phase.
beforeRender :: Action () -> Scheduler ()
-- | Registers an action to be performed during each render phase.
--
-- This phase should only be used by extensions which actually render
-- something.
onRender :: Action () -> Scheduler ()
-- | Registers an action to be performed AFTER each render phase.
--
-- This is useful for cleaning up extension state that was registered for
-- the renderer, but needs to be cleared before the next iteration.
afterRender :: Action () -> Scheduler ()
-- | Registers an action to be performed during the exit phase.
--
-- This is only triggered exactly once when the editor is shutting down.
-- It allows an opportunity to do clean-up, kill any processes you've
-- started, or save any data before the editor terminates.
onExit :: Action () -> Scheduler ()
-- | This represents a range between two coordinates (Coord)
data Range
Range :: Coord -> Coord -> Range
-- | (Coord Row Column) represents a char in a block of text. (zero
-- indexed) e.g. Coord 0 0 is the first character in the text, Coord 2 1
-- is the second character of the third row
data Coord
Coord :: Int -> Int -> Coord
-- | An Offset represents an exact position in a file as a number of
-- characters from the start.
newtype Offset
Offset :: Int -> Offset
-- | A span which maps a piece of Monoidal data over a range.
data Span a
Span :: Range -> a -> Span a
[_getRange] :: Span a -> Range
[_data] :: Span a -> a
-- | Combines a list of spans containing some monoidal data into a list of
-- offsets with with the data that applies from each Offset forwards.
combineSpans :: forall a. Monoid a => [Span a] -> [(Coord, a)]
-- | Given the text you're operating over, creates an iso from an
-- Offset to a Coord.
asCoord :: YiString -> Iso' Offset Coord
-- | This will restrict a given Coord to a valid one which lies
-- within the given text.
clampCoord :: YiString -> Coord -> Coord
-- | This will restrict a given Range to a valid one which lies
-- within the given text.
clampRange :: YiString -> Range -> Range
-- | A lens over text which is encompassed by a Range
range :: Range -> Lens' Buffer YiString
-- | Returns the number of rows and columns that a Range spans as a
-- Coord
sizeOfR :: Range -> Coord
-- | A lens over text after a given Coord
afterC :: Coord -> Lens' YiString YiString
-- | A lens over text before a given Coord
beforeC :: Coord -> Lens' YiString YiString
-- | Moves a Range by a given Coord It may be unintuitive,
-- but for (Coord row col) a given range will be moved down by row and to
-- the right by col.
moveRange :: Coord -> Range -> Range
-- | Moves a range forward by the given amount
moveRangeByN :: Int -> Range -> Range
-- | Moves a Coord forward by the given amount of columns
moveCursorByN :: Int -> Coord -> Coord
-- | An iso which converts to/from YiString -> Text
asText :: Iso' YiString Text
-- | An iso which converts to/from YiString -> String
asString :: Iso' YiString String
-- | An iso which converts to/from YiString -> [YiString]
asLines :: Iso' YiString [YiString]
rope :: Lens' Buffer YiString
-- | clamp min max val restricts val to be within min and max
-- (inclusive)
clamp :: Int -> Int -> Int -> Int
module Rasa
-- | The main function to run rasa.
--
--
-- rasa eventProviders extensions
--
--
-- This should be imported by a user-config and called with extension
-- event providers and extension event hooks as arguments. e.g.:
--
--
-- rasa [slateEvent] $ do
-- cursor
-- vim
--
rasa :: [Action [Keypress]] -> Scheduler () -> IO ()