-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A library for writing papers -- -- This package is a combinator library for writing papers. @package authoring @version 0.3.3.1 module Text.Authoring.Document newtype Document Document :: LaTeX -> Document _latexSrc :: Document -> LaTeX class HasDocument t_a9Um where latexSrc = (document . go_a9Uo) where go_a9Uo _f_a9Up (Document __latexSrc'_a9Uq) = ((\ __latexSrc_a9Ur -> Document __latexSrc_a9Ur) <$> (_f_a9Up __latexSrc'_a9Uq)) document :: HasDocument t_a9Um => Lens' t_a9Um Document latexSrc :: HasDocument t_a9Um => Lens' t_a9Um LaTeX instance HasDocument Document instance Monoid Document instance Eq Document instance Show Document -- | Names of this module are intentitionally kept too short. Use this -- module with quantifier. module Text.Authoring.Combinator.Writer -- | Scribe a LaTeX syntax into the target document. latex :: (MonadWriter t m, HasDocument t) => LaTeX -> m () -- | Scribe a raw text (unescaped) into the target. raw :: (MonadWriter t m, HasDocument t) => Text -> m () -- | Scribe a raw text (escaped) into the target. esc :: (MonadWriter t m, HasDocument t) => Text -> m () -- | Shows objects of type a using Show interface, without -- escaping LaTeX special characters. rawShow :: (MonadWriter t m, HasDocument t, Show a) => a -> m () -- | Shows objects of type a using Show interface, escaping LaTeX -- special characters. escShow :: (MonadWriter t m, HasDocument t, Show a) => a -> m () module Text.Authoring.Combinator.Meta -- | wrap the argument x using curly braces {x} braces :: (MonadWriter t m, HasDocument t) => m () -> m () -- | command0 x = x command0 :: (MonadWriter t m, HasDocument t) => Text -> m () -- | command1 x con = x{con} command1 :: (MonadWriter t m, HasDocument t) => Text -> m () -> m () -- | commandI x con = {x con} commandI :: (MonadWriter t m, HasDocument t) => Text -> m () -> m () -- | environment x con = begin{x}conend{x} environment :: (MonadWriter t m, HasDocument t) => Text -> m () -> m () module Text.Authoring.Label -- | Labels are used to create a unique reference label within a -- paper. data Label FromType :: !TypeRep -> Label FromString :: !String -> Label Ap :: !Label -> !Label -> Label Empty :: Label -- | An infix synonym for mappend. (<>) :: Monoid m => m -> m -> m -- | Create a slightly different version of the label. (./) :: Show a => Label -> a -> Label -- | Create a label from the type of a value. fromValue :: Typeable t => t -> Label instance Eq Label instance Ord Label instance Show Label instance IsString Label instance Monoid Label module Text.Authoring.State -- | The record type of everything you need to know to write a paper. data AuthorState AuthorState :: Map Label Text -> Database -> Set String -> AuthorState _labelMap :: AuthorState -> Map Label Text _citationDB :: AuthorState -> Database _citedUrlSet :: AuthorState -> Set String class HasAuthorState t_abTS where citationDB = (authorState . go_abTU) where go_abTU _f_abTV (AuthorState __labelMap_abTW __citationDB'_abTX __citedUrlSet_abTZ) = ((\ __citationDB_abTY -> AuthorState __labelMap_abTW __citationDB_abTY __citedUrlSet_abTZ) <$> (_f_abTV __citationDB'_abTX)) citedUrlSet = (authorState . go_abU0) where go_abU0 _f_abU1 (AuthorState __labelMap_abU2 __citationDB_abU3 __citedUrlSet'_abU4) = ((\ __citedUrlSet_abU5 -> AuthorState __labelMap_abU2 __citationDB_abU3 __citedUrlSet_abU5) <$> (_f_abU1 __citedUrlSet'_abU4)) labelMap = (authorState . go_abU6) where go_abU6 _f_abU7 (AuthorState __labelMap'_abU8 __citationDB_abUa __citedUrlSet_abUb) = ((\ __labelMap_abU9 -> AuthorState __labelMap_abU9 __citationDB_abUa __citedUrlSet_abUb) <$> (_f_abU7 __labelMap'_abU8)) authorState :: HasAuthorState t_abTS => Lens' t_abTS AuthorState citationDB :: HasAuthorState t_abTS => Lens' t_abTS Database citedUrlSet :: HasAuthorState t_abTS => Lens' t_abTS (Set String) labelMap :: HasAuthorState t_abTS => Lens' t_abTS (Map Label Text) instance Default AuthorState instance HasDatabase AuthorState instance HasAuthorState AuthorState module Text.Authoring.Combinator.Ref -- | refer to a label. ref :: (MonadState s m, HasAuthorState s, MonadWriter w m, HasDocument w) => Label -> m () -- | insert a label. label :: (MonadState s m, HasAuthorState s, MonadWriter w m, HasDocument w) => Label -> m () -- | an interface for mapping any Label to a unique, LaTeX-safe text. getReference :: (MonadState s m, HasAuthorState s) => Label -> m Text -- | This module provides quasi-quotes rawQ and escQ for -- writing papers. The quasi-quotes will generate authoring monads, so -- you can use them in authoring context like follows. -- --
-- paragraph = do
-- let takahashi2007 = citep ["isbn:9784130627184"]
-- val = 3e6
-- [rawQ| The dielectric strength of air is $ #{val} $ V/m @{takahashi2007}. |]
--
--
-- We support antiquote syntax:
--
--
-- #{val}
--
--
-- for embedding values (Show instance is required), and
--
--
-- @{...}
--
--
-- for embedding authring monads.
module Text.Authoring.TH
-- | Quote without escaping any special characters.
rawQ :: QuasiQuoter
-- | Quote with LaTeX special characters escaped.
escQ :: QuasiQuoter
-- | Define a type and a Label from the given name. We use Types to
-- uniquely label concepts within a paper. For example
--
-- -- [declareLabels| myFormula |] ---- -- generates following three lines. -- --
-- data MyFormula = MyFormula deriving Typeable -- myFormula :: Label -- myFormula = fromValue MyFormula ---- -- You can declare multiple labels at one shot by separating them with a -- comma. -- --
-- [declareLabels| FluxConservation, FaradayLaw, GaussLaw, AmpereLaw |] --declareLabels :: QuasiQuoter instance Eq Component instance Show Component module Text.Authoring.Bibliography -- | generate the content for the bibliography file. bibliographyContent :: (MonadState s m, HasAuthorState s, HasDatabase s, MonadIO m) => m Text -- | Excecute the program using the given database file. The file will be -- created if it didn't exist. withDatabaseFile :: (MonadIO m, MonadState s m, HasDatabase s) => FilePath -> m a -> m a module Text.Authoring.Class -- | The all-in-one environ for writing paper. type MonadAuthoring s w m = (MonadState s m, HasAuthorState s, HasDatabase s, MonadWriter w m, HasDocument w, MonadIO m) -- | An example of monad transformer that can provide full (but IO) -- authoring environment. type AuthoringT = RWST () Document AuthorState -- | Run an authoring monad, returns the triple (monad return value, final -- author state, generated latex) runAuthoringT :: Monad m => AuthoringT m a -> m (a, AuthorState, LaTeX) module Text.Authoring.Combinator.Cite -- | Cite a list of documents citet :: MonadAuthoring s w m => [String] -> m () -- | Cite a list of documents citep :: MonadAuthoring s w m => [String] -> m () -- | Cite a single document citet1 :: MonadAuthoring s w m => String -> m () -- | Cite a single document citep1 :: MonadAuthoring s w m => String -> m () -- | make a citation to a document(s). citationGen :: MonadAuthoring s w m => Text -> [String] -> m () module Text.Authoring.Combinator module Text.Authoring