Copyright | (c) Sebastian Witte |
---|---|
License | Apache-2.0 |
Maintainer | woozletoff@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
- class NFData o => NvimObject o where
- type Dictionary = Map ByteString Object
- (+:) :: NvimObject o => o -> [Object] -> [Object]
- class Generic a
- docToObject :: Doc AnsiStyle -> Object
- docFromObject :: Object -> Either (Doc AnsiStyle) (Doc AnsiStyle)
- docToText :: Doc AnsiStyle -> Text
- data Doc ann :: * -> *
- data AnsiStyle :: *
- class Pretty a where
- (<+>) :: Doc ann -> Doc ann -> Doc ann
- module Data.Int
- module Data.Word
- module Control.DeepSeq
Documentation
class NFData o => NvimObject o where Source #
Conversion from Object
files to Haskell types and back with respect
to neovim's interpretation.
The NFData
constraint has been added to allow forcing results of function
evaluations in order to catch exceptions from pure code. This adds more
stability to the plugin provider and seems to be a cleaner approach.
toObject :: o -> Object Source #
fromObjectUnsafe :: Object -> o Source #
fromObject :: Object -> Either (Doc AnsiStyle) o Source #
fromObject' :: MonadIO io => Object -> io o Source #
type Dictionary = Map ByteString Object Source #
A generic vim dictionary is a simply a map from strings to objects. This type alias is sometimes useful as a type annotation especially if the OverloadedStrings extension is enabled.
(+:) :: NvimObject o => o -> [Object] -> [Object] infixr 5 Source #
Convenient operator to create a list of Object
from normal values.
values +: of :+ different :+ types :+ can +: be +: combined +: this +: way +: []
Representable types of kind *. This class is derivable in GHC with the DeriveGeneric flag on.
docFromObject :: Object -> Either (Doc AnsiStyle) (Doc AnsiStyle) Source #
See docToObject
.
The abstract data type
represents pretty documents that have
been annotated with data of type Doc
annann
.
More specifically, a value of type
represents a non-empty set of
possible layouts of a document. The layout functions select one of these
possibilities, taking into account things like the width of the output
document.Doc
The annotation is an arbitrary piece of data associated with (part of) a document. Annotations may be used by the rendering backends in order to display output differently, such as
- color information (e.g. when rendering to the terminal)
- mouseover text (e.g. when rendering to rich HTML)
- whether to show something or not (to allow simple or detailed versions)
The simplest way to display a Doc
is via the Show
class.
>>>
putStrLn (show (vsep ["hello", "world"]))
hello world
Functor Doc | Alter the document’s annotations. This instance makes |
Show (Doc ann) |
|
IsString (Doc ann) |
This instance uses the |
Generic (Doc ann) | |
Semigroup (Doc ann) | x
|
Monoid (Doc ann) |
|
type Rep (Doc ann) | |
Render the annotated document in a certain style. Styles not set in the annotation will use the style of the surrounding document, or the terminal’s default if none has been set yet.
style =color
Green
<>
bold
styledDoc =annotate
style "hello world"
Eq AnsiStyle | |
Ord AnsiStyle | |
Show AnsiStyle | |
Semigroup AnsiStyle | Keep the first decision for each of foreground color, background color, boldness, italication, and underlining. If a certain style is not set, the terminal’s default will be used. Example:
is red because the first color wins, and not bold because (or if) that’s the terminal’s default. |
Monoid AnsiStyle |
|
>>>
pretty 1 <+> pretty "hello" <+> pretty 1.234
1 hello 1.234
prettyList :: [a] -> Doc ann #
is only used to define the prettyList
instance
. In normal circumstances only the Pretty
a => Pretty
[a]
function is used.pretty
>>>
prettyList [1, 23, 456]
[1, 23, 456]
Pretty Bool |
|
Pretty Char | Instead of
|
Pretty Double |
|
Pretty Float |
|
Pretty Int |
|
Pretty Int8 | |
Pretty Int16 | |
Pretty Int32 | |
Pretty Int64 | |
Pretty Integer |
|
Pretty Natural | |
Pretty Word | |
Pretty Word8 | |
Pretty Word16 | |
Pretty Word32 | |
Pretty Word64 | |
Pretty () |
The argument is not used,
|
Pretty Void | Finding a good example for printing something that does not exist is hard, so here is an example of printing a list full of nothing.
|
Pretty Text | Automatically converts all newlines to
Note that
Manually use |
Pretty Text | (lazy |
Pretty AutocmdOptions # | |
Pretty CommandArguments # | |
Pretty RangeSpecification # | |
Pretty CommandOptions # | |
Pretty CommandOption # | |
Pretty Synchronous # | |
Pretty FunctionalityDescription # | |
Pretty FunctionName # | |
Pretty Notification # | |
Pretty Request # | |
Pretty FunctionCall # | |
Pretty FunctionType # | |
Pretty Message # | |
Pretty a => Pretty [a] |
|
Pretty a => Pretty (Maybe a) | Ignore
|
Pretty a => Pretty (NonEmpty a) | |
Pretty a => Pretty (Identity a) |
|
(Pretty a1, Pretty a2) => Pretty (a1, a2) |
|
(Pretty a1, Pretty a2, Pretty a3) => Pretty (a1, a2, a3) |
|
Pretty a => Pretty (Const * a b) | |
module Data.Int
module Data.Word
module Control.DeepSeq