output-blocks-0.5.0.1
Safe HaskellNone
LanguageHaskell2010

Control.OutputCapable.Blocks.Type

Description

A version of the Type module specialised to Language. It provides basically the same interface but specialised to Output and additionally a somewhat more general SpecialOutput variant. Both type synonyms are also provided.

Synopsis

common constructors

pattern YesNo :: Bool -> [GenericOutput language element] -> GenericOutput language element Source #

output condition check, but continue afterwards

pattern Image :: FilePath -> GenericOutput language element Source #

a single image

pattern Images :: Map String FilePath -> GenericOutput language element Source #

multiple images with a text tag that is to be printed (e.g. a number)

pattern Paragraph :: [GenericOutput language element] -> GenericOutput language element Source #

to group (and separate) output

pattern Enumerated :: [([GenericOutput language element], [GenericOutput language element])] -> GenericOutput language element Source #

an enumeration with the enumerator first and content second

pattern Itemized :: [[GenericOutput language element]] -> GenericOutput language element Source #

like enumeration (but without enumerator)

pattern Indented :: [GenericOutput language element] -> GenericOutput language element Source #

for indenting output

pattern Latex :: String -> GenericOutput language element Source #

latex code (for formulas and text blocks only)

pattern Folded :: Bool -> Map language String -> [GenericOutput language element] -> GenericOutput language element Source #

minimisable output with default open-state, title and content

pattern Code :: Map language String -> GenericOutput language element Source #

to output as text with fixed width, providing translations

pattern Translated :: Map language String -> GenericOutput language element Source #

normal text with translations

pattern Special :: element -> GenericOutput language element Source #

allows abbreviating several complex parts which have special rendering functions which are not easily representable as ADT

the interface

for Output

type Output = SpecialOutput () Source #

SpecialOutput without Special elements

getOutputSequence :: Functor m => LangM (ReportT Output m) -> m [Output] Source #

Converts non graded OutputCapable value using GenericOutput into a list of Output

getOutputSequenceWithRating :: Functor m => Rated (ReportT Output m) -> m (Maybe Rational, [Output]) Source #

Converts graded OutputCapable value using GenericOutput into a rating and a list of Output

getOutputSequenceWithResult :: Functor m => LangM' (ReportT Output m) a -> m (Maybe a, [Output]) Source #

Converts OutputCapable value using GenericOutput into a result and a list of Output

Consider using getOutputSequenceWithRating in order to get better error messages on implementation errors.

toOutputCapable :: forall (m :: Type -> Type). OutputCapable m => [Output] -> LangM m Source #

Convert a list of Output into any instance of OutputCapable

for SpecialOutput

type SpecialOutput = GenericOutput Language Source #

GenericOutput but with translations fixed to Language

checkTranslations :: (element -> [String]) -> SpecialOutput element -> [String] Source #

Checks SpecialOutput for missing translations.

@since: 0.3.0.1

foldMapOutputBy :: (a -> a -> a) -> (SpecialOutput element -> a) -> SpecialOutput element -> a Source #

A right fold with the possibility to inspect every node.

@since: 0.4

getSpecialOutputSequence :: Functor m => LangM (ReportT (SpecialOutput element) m) -> m [SpecialOutput element] Source #

Converts non graded OutputCapable value using GenericOutput into a list of SpecialOutput

getSpecialOutputSequenceWithRating :: Functor m => Rated (ReportT (SpecialOutput element) m) -> m (Maybe Rational, [SpecialOutput element]) Source #

Converts graded OutputCapable value using GenericOutput into a rating and a list of SpecialOutput

specialToOutputCapable :: forall (m :: Type -> Type) element. OutputCapable m => (element -> LangM m) -> [SpecialOutput element] -> LangM m Source #

Convert a list of SpecialOutput into any instance of OutputCapable

other

checkTranslation :: Map Language String -> [String] Source #

Checks a Map for missing translations and reports those as list.

@since: 0.3.0.2