| Copyright | (c) 2013-2020 Brendan Hay <brendan.g.hay@gmail.com> |
|---|---|
| License | This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. A copy of the MPL can be found in the LICENSE file or you can obtain it at http://mozilla.org/MPL/2.0/. |
| Maintainer | Brendan Hay <brendan.g.hay@gmail.com> |
| Stability | experimental |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Text.EDE.Internal.Types
Description
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!
Synopsis
- type AnsiDoc = Doc AnsiStyle
- class AnsiPretty a where
- newtype PP a = PP {
- unPP :: a
- pp :: AnsiPretty (PP a) => a -> AnsiDoc
- (</>) :: Doc ann -> Doc ann -> Doc ann
- bold :: AnsiDoc -> AnsiDoc
- red :: AnsiDoc -> AnsiDoc
- data Result a
- _Failure :: forall a. Prism' (Result a) AnsiDoc
- _Success :: forall a a. Prism (Result a) (Result a) a a
- eitherResult :: Result a -> Either String a
- result :: (AnsiDoc -> b) -> (a -> b) -> Result a -> b
- success :: Monad m => a -> m (Result a)
- failure :: Monad m => AnsiDoc -> m (Result a)
- type Delim = (String, String)
- data Syntax = Syntax {
- _delimPragma :: !Delim
- _delimInline :: !Delim
- _delimComment :: !Delim
- _delimBlock :: !Delim
- class HasSyntax c where
- syntax :: Lens' c Syntax
- delimBlock :: Lens' c Delim
- delimComment :: Lens' c Delim
- delimInline :: Lens' c Delim
- delimPragma :: Lens' c Delim
- type Resolver m = Syntax -> Id -> Delta -> m (Result Template)
- data Template = Template {}
- type Id = Text
- newtype Var = Var (NonEmpty Id)
- data Collection where
- data Pat
- type Alt a = (Pat, a)
- data ExpF a
- type Exp = Cofree ExpF
- fromValue :: Value -> Maybe (HashMap Text Value)
- fromPairs :: [Pair] -> HashMap Text Value
Documentation
class AnsiPretty a where Source #
Instances
| AnsiPretty Var Source # | |
| AnsiPretty Term Source # | |
| Show a => AnsiPretty (Result a) Source # | |
| AnsiPretty (PP Text) Source # | |
| AnsiPretty (PP Value) Source # | |
Convenience wrapper for Pretty instances.
The result of running parsing or rendering steps.
Instances
| Monad Result Source # | |
| Functor Result Source # | |
| Applicative Result Source # | |
| Foldable Result Source # | |
Defined in Text.EDE.Internal.Types Methods fold :: Monoid m => Result m -> m # foldMap :: Monoid m => (a -> m) -> Result a -> m # foldMap' :: Monoid m => (a -> m) -> Result a -> m # foldr :: (a -> b -> b) -> b -> Result a -> b # foldr' :: (a -> b -> b) -> b -> Result a -> b # foldl :: (b -> a -> b) -> b -> Result a -> b # foldl' :: (b -> a -> b) -> b -> Result a -> b # foldr1 :: (a -> a -> a) -> Result a -> a # foldl1 :: (a -> a -> a) -> Result a -> a # elem :: Eq a => a -> Result a -> Bool # maximum :: Ord a => Result a -> a # minimum :: Ord a => Result a -> a # | |
| Traversable Result Source # | |
| Alternative Result Source # | |
| Show a => Show (Result a) Source # | |
| Show a => AnsiPretty (Result a) Source # | |
Arguments
| :: (AnsiDoc -> b) | Function to apply to the |
| -> (a -> b) | Function to apply to the |
| -> Result a | The |
| -> b |
Perform a case analysis on a Result.
Constructors
| Syntax | |
Fields
| |
class HasSyntax c where Source #
Minimal complete definition
Methods
syntax :: Lens' c Syntax Source #
delimBlock :: Lens' c Delim Source #
delimComment :: Lens' c Delim Source #
delimInline :: Lens' c Delim Source #
delimPragma :: Lens' c Delim Source #
type Resolver m = Syntax -> Id -> Delta -> m (Result Template) Source #
A function to resolve the target of an include expression.
A parsed and compiled template.
Constructors
| Template | |
data Collection where Source #
Instances
| Unquote Collection Source # | |
Defined in Text.EDE.Internal.Quoting | |
Constructors
| ELit !Value | |
| EVar !Var | |
| EFun !Id | |
| EApp !a !a | |
| ELet !Id !a !a | |
| ECase !a [Alt a] | |
| ELoop !Id !a !a | |
| EIncl !Text |