Safe Haskell | None |
---|---|
Language | Haskell2010 |
Control.OutputCapable.Blocks.Generic.Type
Description
Provides an Algebraic Data Type to represent GenericOutput
.
This can be useful in cases where the raw representation needs to be persisted
or for converting the type of GenericOutputCapable
.
Synopsis
- data GenericOutput language element
- = YesNo Bool [GenericOutput language element]
- | Image FilePath
- | Images (Map String FilePath)
- | Paragraph [GenericOutput language element]
- | Enumerated [([GenericOutput language element], [GenericOutput language element])]
- | Itemized [[GenericOutput language element]]
- | Indented [GenericOutput language element]
- | Latex String
- | Folded Bool (Map language String) [GenericOutput language element]
- | Code (Map language String)
- | Translated (Map language String)
- | Special element
- foldMapOutputBy :: (a -> a -> a) -> (GenericOutput language element -> a) -> GenericOutput language element -> a
- getOutputSequence :: Functor m => language -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () -> m [GenericOutput language element]
- getOutputSequenceWithResult :: Functor m => language -> GenericLangM language (GenericReportT language (GenericOutput language element) m) a -> m (Maybe a, [GenericOutput language element])
- getOutputSequenceWithRating :: Functor m => language -> GenericLangM language (GenericReportT language (GenericOutput language element) m) Rational -> m (Maybe Rational, [GenericOutput language element])
- inspectTranslations :: (element -> a) -> (Map language String -> a) -> (a -> a -> a) -> a -> GenericOutput language element -> a
- toOutputCapable :: forall language (m :: Type -> Type) element. GenericOutputCapable language m => (element -> GenericLangM language m ()) -> (Bool -> GenericLangM language m () -> GenericLangM language m ()) -> [GenericOutput language element] -> GenericLangM language m ()
Documentation
data GenericOutput language element Source #
Data type miming the OutputCapable class interface. Can be used to Prototype without defining additional instances. The result can be converted into any member of the class.
Constructors
YesNo Bool [GenericOutput language element] | output condition check, but continue afterwards |
Image FilePath | a single image |
Images (Map String FilePath) | multiple images with a text tag that is to be printed (e.g. a number) |
Paragraph [GenericOutput language element] | to group (and separate) output |
Enumerated [([GenericOutput language element], [GenericOutput language element])] | an enumeration with the enumerator first and content second |
Itemized [[GenericOutput language element]] | like enumeration (but without enumerator) |
Indented [GenericOutput language element] | for indenting output |
Latex String | latex code (for formulas and text blocks only) |
Folded Bool (Map language String) [GenericOutput language element] | minimisable output with default open-state, title and content |
Code (Map language String) | to output as text with fixed width, providing translations |
Translated (Map language String) | normal text with translations |
Special element | allows abbreviating several complex parts which have special rendering functions which are not easily representable as ADT |
Instances
foldMapOutputBy :: (a -> a -> a) -> (GenericOutput language element -> a) -> GenericOutput language element -> a Source #
A right fold with the possibility to inspect every node.
@since: 0.4
getOutputSequence :: Functor m => language -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () -> m [GenericOutput language element] Source #
Converts non graded GenericOutputCapable
value using GenericOutput
into a list of GenericOutput
getOutputSequenceWithResult :: Functor m => language -> GenericLangM language (GenericReportT language (GenericOutput language element) m) a -> m (Maybe a, [GenericOutput language element]) Source #
Converts GenericOutputCapable
value using GenericOutput
into a result and a list of GenericOutput
Consider using getOutputSequenceWithRating
or even more specific versions of Type
in order to get better error messages on implementation errors.
getOutputSequenceWithRating :: Functor m => language -> GenericLangM language (GenericReportT language (GenericOutput language element) m) Rational -> m (Maybe Rational, [GenericOutput language element]) Source #
More concretely typed alias of getOutputSequenceWithResult
Converts graded GenericOutputCapable
value using GenericOutput
into a rating and a list of GenericOutput
inspectTranslations :: (element -> a) -> (Map language String -> a) -> (a -> a -> a) -> a -> GenericOutput language element -> a Source #
Inspects translations provided the given inspect and combining functions.
@since: 0.3.0.1
toOutputCapable :: forall language (m :: Type -> Type) element. GenericOutputCapable language m => (element -> GenericLangM language m ()) -> (Bool -> GenericLangM language m () -> GenericLangM language m ()) -> [GenericOutput language element] -> GenericLangM language m () Source #
Convert a list of GenericOutput
into any member of GenericOutputCapable