/usr/share/doc/libghc-shakespeare-doc/html/shakespeare.txt is in libghc-shakespeare-doc 2.0.7-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 | -- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A toolkit for making compile-time interpolated templates
--
-- Shakespeare is a family of type-safe, efficient template languages.
-- Shakespeare templates are expanded at compile-time, ensuring that all
-- interpolated variables are in scope. Variables are interpolated
-- according to their type through a typeclass.
--
-- Shakespeare templates can be used inline with a quasi-quoter or in an
-- external file.
--
-- Note there is no dependency on haskell-src-extras. Instead Shakespeare
-- believes logic should stay out of templates and has its own minimal
-- Haskell parser.
--
-- Packages that use this: shakespeare-js, shakespeare-css,
-- shakespeare-text, hamlet, and xml-hamlet
--
-- Please see the documentation at
-- <a>http://www.yesodweb.com/book/shakespearean-templates</a> for more
-- details.
@package shakespeare
@version 2.0.7
-- | General parsers, functions and datatypes for all Shakespeare
-- languages.
module Text.Shakespeare.Base
data Deref
DerefModulesIdent :: [String] -> Ident -> Deref
DerefIdent :: Ident -> Deref
DerefIntegral :: Integer -> Deref
DerefRational :: Rational -> Deref
DerefString :: String -> Deref
DerefBranch :: Deref -> Deref -> Deref
DerefList :: [Deref] -> Deref
DerefTuple :: [Deref] -> Deref
newtype Ident
Ident :: String -> Ident
type Scope = [(Ident, Exp)]
parseDeref :: UserParser a Deref
parseHash :: UserParser a (Either String Deref)
parseVar :: Char -> UserParser a (Either String Deref)
parseVarString :: Char -> UserParser a (Either String String)
parseAt :: UserParser a (Either String (Deref, Bool))
parseUrl :: Char -> Char -> UserParser a (Either String (Deref, Bool))
parseUrlString :: Char -> Char -> UserParser a (Either String String)
parseCaret :: UserParser a (Either String Deref)
parseUnder :: UserParser a (Either String Deref)
parseInt :: Char -> UserParser a (Either String Deref)
parseIntString :: Char -> UserParser a (Either String String)
derefToExp :: Scope -> Deref -> Exp
flattenDeref :: Deref -> Maybe [String]
readUtf8File :: FilePath -> IO Text
instance GHC.Classes.Ord Text.Shakespeare.Base.Deref
instance Data.Data.Data Text.Shakespeare.Base.Deref
instance GHC.Read.Read Text.Shakespeare.Base.Deref
instance GHC.Classes.Eq Text.Shakespeare.Base.Deref
instance GHC.Show.Show Text.Shakespeare.Base.Deref
instance GHC.Classes.Ord Text.Shakespeare.Base.Ident
instance Data.Data.Data Text.Shakespeare.Base.Ident
instance GHC.Read.Read Text.Shakespeare.Base.Ident
instance GHC.Classes.Eq Text.Shakespeare.Base.Ident
instance GHC.Show.Show Text.Shakespeare.Base.Ident
instance Language.Haskell.TH.Syntax.Lift Text.Shakespeare.Base.Ident
instance Language.Haskell.TH.Syntax.Lift Text.Shakespeare.Base.Deref
module Text.Hamlet
type Html = Markup
shamlet :: QuasiQuoter
shamletFile :: FilePath -> Q Exp
xshamlet :: QuasiQuoter
xshamletFile :: FilePath -> Q Exp
-- | A function generating an <a>Html</a> given a URL-rendering function.
type HtmlUrl url = Render url -> Html
hamlet :: QuasiQuoter
hamletFile :: FilePath -> Q Exp
hamletFileReload :: FilePath -> Q Exp
ihamletFileReload :: FilePath -> Q Exp
xhamlet :: QuasiQuoter
xhamletFile :: FilePath -> Q Exp
-- | A function generating an <a>Html</a> given a message translator and a
-- URL rendering function.
type HtmlUrlI18n msg url = Translate msg -> Render url -> Html
ihamlet :: QuasiQuoter
ihamletFile :: FilePath -> Q Exp
-- | Convert some value to a list of attribute pairs.
class ToAttributes a
toAttributes :: ToAttributes a => a -> [(Text, Text)]
-- | Settings for parsing of a hamlet document.
data HamletSettings
HamletSettings :: String -> NewlineStyle -> (String -> CloseStyle) -> [(String, String)] -> HamletSettings
-- | The value to replace a "!!!" with. Do not include the trailing
-- newline.
[hamletDoctype] :: HamletSettings -> String
-- | Should we add newlines to the output, making it more human-readable?
-- Useful for client-side debugging but may alter browser page layout.
[hamletNewlines] :: HamletSettings -> NewlineStyle
-- | How a tag should be closed. Use this to switch between HTML, XHTML or
-- even XML output.
[hamletCloseStyle] :: HamletSettings -> String -> CloseStyle
-- | Mapping from short names in "$doctype" statements to full doctype.
[hamletDoctypeNames] :: HamletSettings -> [(String, String)]
data NewlineStyle
-- | never add newlines
NoNewlines :: NewlineStyle
-- | add newlines between consecutive text lines
NewlinesText :: NewlineStyle
-- | add newlines everywhere
AlwaysNewlines :: NewlineStyle
DefaultNewlineStyle :: NewlineStyle
hamletWithSettings :: Q HamletRules -> HamletSettings -> QuasiQuoter
hamletFileWithSettings :: Q HamletRules -> HamletSettings -> FilePath -> Q Exp
-- | Defaults settings: HTML5 doctype and HTML-style empty tags.
defaultHamletSettings :: HamletSettings
xhtmlHamletSettings :: HamletSettings
data Env
Env :: Maybe ((Exp -> Q Exp) -> Q Exp) -> Maybe ((Exp -> Q Exp) -> Q Exp) -> Env
[urlRender] :: Env -> Maybe ((Exp -> Q Exp) -> Q Exp)
[msgRender] :: Env -> Maybe ((Exp -> Q Exp) -> Q Exp)
data HamletRules
HamletRules :: Exp -> ((Env -> Q Exp) -> Q Exp) -> (Env -> Exp -> Q Exp) -> HamletRules
[hrFromHtml] :: HamletRules -> Exp
[hrWithEnv] :: HamletRules -> (Env -> Q Exp) -> Q Exp
[hrEmbed] :: HamletRules -> Env -> Exp -> Q Exp
hamletRules :: Q HamletRules
ihamletRules :: Q HamletRules
htmlRules :: Q HamletRules
data CloseStyle
NoClose :: CloseStyle
CloseInside :: CloseStyle
CloseSeparate :: CloseStyle
-- | Checks for truth in the left value in each pair in the first argument.
-- If a true exists, then the corresponding right action is performed.
-- Only the first is performed. In there are no true values, then the
-- second argument is performed, if supplied.
condH :: Monad m => [(Bool, m ())] -> Maybe (m ()) -> m ()
-- | Runs the second argument with the value in the first, if available.
-- Otherwise, runs the third argument, if available.
maybeH :: Monad m => Maybe v -> (v -> m ()) -> Maybe (m ()) -> m ()
asHtmlUrl :: HtmlUrl url -> HtmlUrl url
attrsToHtml :: [(Text, Text)] -> Html
instance Text.Hamlet.ToAttributes (Data.Text.Internal.Text, Data.Text.Internal.Text)
instance Text.Hamlet.ToAttributes (GHC.Base.String, GHC.Base.String)
instance Text.Hamlet.ToAttributes [(Data.Text.Internal.Text, Data.Text.Internal.Text)]
instance Text.Hamlet.ToAttributes [(GHC.Base.String, GHC.Base.String)]
instance GHC.Show.Show (Text.Hamlet.VarExp msg url)
-- | Provides functionality for runtime Hamlet templates. Please use
-- <a>Text.Hamlet.Runtime</a> instead.
module Text.Hamlet.RT
newtype HamletRT
HamletRT :: [SimpleDoc] -> HamletRT
data HamletData url
HDHtml :: Html -> HamletData url
HDUrl :: url -> HamletData url
HDUrlParams :: url -> [(Text, Text)] -> HamletData url
HDTemplate :: HamletRT -> HamletData url
HDBool :: Bool -> HamletData url
HDMaybe :: (Maybe (HamletMap url)) -> HamletData url
HDList :: [HamletMap url] -> HamletData url
type HamletMap url = [([String], HamletData url)]
data HamletException
HamletParseException :: String -> HamletException
HamletUnsupportedDocException :: Doc -> HamletException
HamletRenderException :: String -> HamletException
parseHamletRT :: MonadThrow m => HamletSettings -> String -> m HamletRT
renderHamletRT :: MonadThrow m => HamletRT -> HamletMap url -> UrlRenderer url -> m Html
renderHamletRT' :: MonadThrow m => Bool -> HamletRT -> HamletMap url -> (url -> [(Text, Text)] -> Text) -> m Html
data SimpleDoc
SDRaw :: String -> SimpleDoc
SDVar :: [String] -> SimpleDoc
SDUrl :: Bool -> [String] -> SimpleDoc
SDTemplate :: [String] -> SimpleDoc
SDForall :: [String] -> String -> [SimpleDoc] -> SimpleDoc
SDMaybe :: [String] -> String -> [SimpleDoc] -> [SimpleDoc] -> SimpleDoc
SDCond :: [([String], [SimpleDoc])] -> [SimpleDoc] -> SimpleDoc
instance GHC.Show.Show Text.Hamlet.RT.HamletException
instance GHC.Exception.Exception Text.Hamlet.RT.HamletException
-- | Module for parsing and rendering Hamlet templates at runtime, not
-- compile time. This uses the same Hamlet parsing as compile-time
-- Hamlet, but has some limitations, such as:
--
-- <ul>
-- <li>No compile-time checking of validity</li>
-- <li>Can't apply functions at runtime</li>
-- <li>No URL rendering</li>
-- </ul>
--
-- <pre>
-- {-# LANGUAGE OverloadedStrings #-}
-- import Text.Hamlet.Runtime
-- import qualified Data.Map as Map
-- import Text.Blaze.Html.Renderer.String (renderHtml)
--
-- main :: IO ()
-- main = do
-- template <- parseHamletTemplate defaultHamletSettings $ unlines
-- [ "<p>Hello, #{name}"
-- , "$if hungry"
-- , " <p>Available food:"
-- , " <ul>"
-- , " $forall food <- foods"
-- , " <li>#{food}"
-- ]
-- let hamletDataMap = Map.fromList
-- [ ("name", "Michael")
-- , ("hungry", toHamletData True) -- always True
-- , ("foods", toHamletData
-- [ "Apples"
-- , "Bananas"
-- , "Carrots"
-- ])
-- ]
-- html <- renderHamletTemplate template hamletDataMap
-- putStrLn $ renderHtml html
-- </pre>
module Text.Hamlet.Runtime
-- | A parsed Hamlet template. See <a>parseHamletTemplate</a> and
-- <a>readHamletTemplateFile</a>.
data HamletTemplate
-- | Settings for parsing of a hamlet document.
data HamletSettings
-- | Defaults settings: HTML5 doctype and HTML-style empty tags.
defaultHamletSettings :: HamletSettings
-- | A piece of data that can be embedded and passed to a Hamlet template
-- (via <a>renderHamletTemplate</a>).
--
-- This supplies an <a>IsString</a> instance, so with
-- <tt>OverloadedStrings</tt> it will support literal strings, which are
-- converted to HTML via <a>toHtml</a>. For other datatypes, use
-- <a>toHamletData</a>.
data HamletData
-- | Data which can be passed to a Hamlet template.
class ToHamletData a
toHamletData :: ToHamletData a => a -> HamletData
-- | Parse an in-memory Hamlet template. This operation may fail if the
-- template is not parsable.
parseHamletTemplate :: MonadThrow m => HamletSettings -> String -> m HamletTemplate
-- | Same as <a>parseHamletTemplate</a>, but reads from a file. The file is
-- assumed to be UTF-8 encoded (same assumption as compile-time Hamlet).
readHamletTemplateFile :: (MonadThrow m, MonadIO m) => HamletSettings -> FilePath -> m HamletTemplate
-- | Render a runtime Hamlet template, together with a <a>Map</a> of
-- variables to pass in, into an <a>Html</a> value. This can fail if the
-- template references a variable that is not present in the
-- <tt>Map</tt>.
renderHamletTemplate :: MonadThrow m => HamletTemplate -> Map Text HamletData -> m Html
instance Data.String.IsString Text.Hamlet.Runtime.HamletData
instance Text.Hamlet.Runtime.ToHamletData Text.Hamlet.Runtime.HamletData
instance (a ~ Text.Hamlet.Runtime.HamletData) => Text.Hamlet.Runtime.ToHamletData [a]
instance (a ~ Text.Hamlet.Runtime.HamletData) => Text.Hamlet.Runtime.ToHamletData (GHC.Base.Maybe a)
instance Text.Hamlet.Runtime.ToHamletData Data.Text.Internal.Text
instance Text.Hamlet.Runtime.ToHamletData Text.Blaze.Html.Html
instance Text.Hamlet.Runtime.ToHamletData GHC.Types.Bool
-- | This module provides a type-based system for providing translations
-- for text strings.
--
-- It is similar in purpose to gettext or Java message bundles.
--
-- The core idea is to create simple data type where each constructor
-- represents a phrase, sentence, paragraph, etc. For example:
--
-- <pre>
-- data AppMessages = Hello | Goodbye
-- </pre>
--
-- The <a>RenderMessage</a> class is used to retrieve the appropriate
-- translation for a message value:
--
-- <pre>
-- class RenderMessage master message where
-- renderMessage :: master -- ^ type that specifies which set of translations to use
-- -> [Lang] -- ^ acceptable languages in descending order of preference
-- -> message -- ^ message to translate
-- -> Text
-- </pre>
--
-- Defining the translation type and providing the <a>RenderMessage</a>
-- instance in Haskell is not very translator friendly. Instead,
-- translations are generally provided in external translations files.
-- Then the <a>mkMessage</a> Template Haskell function is used to read
-- the external translation files and automatically create the
-- translation type and the <tt>RenderMessage</tt> instance.
--
-- A full description of using this module to create translations for
-- <tt>Hamlet</tt> can be found here:
--
-- <a>http://www.yesodweb.com/book/internationalization</a>
--
-- A full description of using the module to create translations for
-- <tt>HSP</tt> can be found here:
--
-- <a>http://happstack.com/docs/crashcourse/Templates.html#hsp-i18n</a>
--
-- You can also adapt those instructions for use with other systems.
module Text.Shakespeare.I18N
-- | generate translations from translation files
--
-- This function will:
--
-- <ol>
-- <li>look in the supplied subdirectory for files ending in
-- <tt>.msg</tt></li>
-- <li>generate a type based on the constructors found</li>
-- <li>create a <a>RenderMessage</a> instance</li>
-- </ol>
mkMessage :: String -> FilePath -> Lang -> Q [Dec]
-- | create <a>RenderMessage</a> instance for an existing data-type
mkMessageFor :: String -> String -> FilePath -> Lang -> Q [Dec]
-- | create an additional set of translations for a type created by
-- <a>mkMessage</a>
mkMessageVariant :: String -> String -> FilePath -> Lang -> Q [Dec]
-- | the <a>RenderMessage</a> is used to provide translations for a message
-- types
--
-- The <tt>master</tt> argument exists so that it is possible to provide
-- more than one set of translations for a <tt>message</tt> type. This is
-- useful if a library provides a default set of translations, but the
-- user of the library wants to provide a different set of translations.
class RenderMessage master message
renderMessage :: RenderMessage master message => master -> [Lang] -> message -> Text
-- | <a>ToMessage</a> is used to convert the value inside #{ } to
-- <a>Text</a>
--
-- The primary purpose of this class is to allow the value in #{ } to be
-- a <a>String</a> or <a>Text</a> rather than forcing it to always be
-- <a>Text</a>.
class ToMessage a
toMessage :: ToMessage a => a -> Text
data SomeMessage master
SomeMessage :: msg -> SomeMessage master
-- | an RFC1766 / ISO 639-1 language code (eg, <tt>fr</tt>, <tt>en-GB</tt>,
-- etc).
type Lang = Text
instance Text.Shakespeare.I18N.ToMessage Data.Text.Internal.Text
instance Text.Shakespeare.I18N.ToMessage GHC.Base.String
instance Text.Shakespeare.I18N.RenderMessage master Data.Text.Internal.Text
instance Data.String.IsString (Text.Shakespeare.I18N.SomeMessage master)
instance (master ~ master') => Text.Shakespeare.I18N.RenderMessage master (Text.Shakespeare.I18N.SomeMessage master')
-- | NOTE: This module should be considered internal, and will be hidden in
-- future releases.
module Text.Shakespeare
data ShakespeareSettings
ShakespeareSettings :: Char -> Char -> Char -> Exp -> Exp -> Exp -> Bool -> Maybe PreConvert -> Maybe Exp -> ShakespeareSettings
[varChar] :: ShakespeareSettings -> Char
[urlChar] :: ShakespeareSettings -> Char
[intChar] :: ShakespeareSettings -> Char
[toBuilder] :: ShakespeareSettings -> Exp
[wrap] :: ShakespeareSettings -> Exp
[unwrap] :: ShakespeareSettings -> Exp
[justVarInterpolation] :: ShakespeareSettings -> Bool
[preConversion] :: ShakespeareSettings -> Maybe PreConvert
-- | A transformation applied to the final expression. Most often, this
-- would be used to force the type of the expression to help make more
-- meaningful error messages.
[modifyFinalValue] :: ShakespeareSettings -> Maybe Exp
-- | Coffeescript, TypeScript, and other languages compiles down to
-- Javascript. Previously we waited until the very end, at the rendering
-- stage to perform this compilation. Lets call is a post-conversion This
-- had the advantage that all Haskell values were inserted first: for
-- example a value could be inserted that Coffeescript would compile into
-- Javascript. While that is perhaps a safer approach, the advantage is
-- not used in practice: it was that way mainly for ease of
-- implementation. The down-side is the template must be compiled down to
-- Javascript during every request. If instead we do a pre-conversion to
-- compile down to Javascript, we only need to perform the compilation
-- once.
--
-- The problem then is the insertion of Haskell values: we need a hole
-- for them. This can be done with variables known to the language.
-- During the pre-conversion we first modify all Haskell insertions So
-- #{a} is change to shakespeare_var_a Then we can place the Haskell
-- values in a function wrapper that exposes those variables:
-- (function(shakespeare_var_a){ ... shakespeare_var_a ...}) TypeScript
-- can compile that, and then we tack an application of the Haskell
-- values onto the result: (#{a})
--
-- preEscapeIgnoreBalanced is used to not insert backtacks for variable
-- already inside strings or backticks. coffeescript will happily ignore
-- the interpolations, and backticks would not be treated as escaping in
-- that context. preEscapeIgnoreLine was added to ignore comments (which
-- in Coffeescript begin with a '#')
data PreConvert
PreConvert :: PreConversion -> [Char] -> [Char] -> Maybe WrapInsertion -> PreConvert
[preConvert] :: PreConvert -> PreConversion
[preEscapeIgnoreBalanced] :: PreConvert -> [Char]
[preEscapeIgnoreLine] :: PreConvert -> [Char]
[wrapInsertion] :: PreConvert -> Maybe WrapInsertion
data WrapInsertion
WrapInsertion :: Maybe String -> String -> String -> String -> String -> Bool -> WrapInsertion
[wrapInsertionIndent] :: WrapInsertion -> Maybe String
[wrapInsertionStartBegin] :: WrapInsertion -> String
[wrapInsertionSeparator] :: WrapInsertion -> String
[wrapInsertionStartClose] :: WrapInsertion -> String
[wrapInsertionEnd] :: WrapInsertion -> String
[wrapInsertionAddParens] :: WrapInsertion -> Bool
data PreConversion
ReadProcess :: String -> [String] -> PreConversion
Id :: PreConversion
defaultShakespeareSettings :: ShakespeareSettings
shakespeare :: ShakespeareSettings -> QuasiQuoter
shakespeareFile :: ShakespeareSettings -> FilePath -> Q Exp
shakespeareFileReload :: ShakespeareSettings -> FilePath -> Q Exp
shakespeareFromString :: ShakespeareSettings -> String -> Q Exp
-- | Determine which identifiers are used by the given template, useful for
-- creating systems like yesod devel.
shakespeareUsedIdentifiers :: ShakespeareSettings -> String -> [(Deref, VarType)]
type RenderUrl url = url -> QueryParameters -> Text
data VarType
VTPlain :: VarType
VTUrl :: VarType
VTUrlParam :: VarType
VTMixin :: VarType
data Deref
-- | A parser with a user state of [String]
type Parser = Parsec String [String]
preFilter :: Maybe FilePath -> ShakespeareSettings -> String -> IO String
shakespeareRuntime :: ShakespeareSettings -> FilePath -> [(Deref, VarExp url)] -> Shakespeare url
pack' :: String -> Text
instance GHC.Generics.Constructor Text.Shakespeare.C1_3VarType
instance GHC.Generics.Constructor Text.Shakespeare.C1_2VarType
instance GHC.Generics.Constructor Text.Shakespeare.C1_1VarType
instance GHC.Generics.Constructor Text.Shakespeare.C1_0VarType
instance GHC.Generics.Datatype Text.Shakespeare.D1VarType
instance GHC.Generics.Generic Text.Shakespeare.VarType
instance Data.Data.Data Text.Shakespeare.VarType
instance GHC.Enum.Bounded Text.Shakespeare.VarType
instance GHC.Enum.Enum Text.Shakespeare.VarType
instance GHC.Classes.Ord Text.Shakespeare.VarType
instance GHC.Classes.Eq Text.Shakespeare.VarType
instance GHC.Show.Show Text.Shakespeare.VarType
instance GHC.Classes.Eq Text.Shakespeare.Content
instance GHC.Show.Show Text.Shakespeare.Content
instance Language.Haskell.TH.Syntax.Lift Text.Shakespeare.PreConvert
instance Language.Haskell.TH.Syntax.Lift Text.Shakespeare.WrapInsertion
instance Language.Haskell.TH.Syntax.Lift Text.Shakespeare.PreConversion
instance Language.Haskell.TH.Syntax.Lift Text.Shakespeare.ShakespeareSettings
module Text.Shakespeare.Text
type TextUrl url = RenderUrl url -> Builder
class ToText a
toText :: ToText a => a -> Builder
renderTextUrl :: RenderUrl url -> TextUrl url -> Text
stext :: QuasiQuoter
text :: QuasiQuoter
textFile :: FilePath -> Q Exp
-- | <i>Deprecated: Please use textFileReload instead</i>
textFileDebug :: FilePath -> Q Exp
textFileReload :: FilePath -> Q Exp
st :: QuasiQuoter
lt :: QuasiQuoter
sbt :: QuasiQuoter
lbt :: QuasiQuoter
-- | codegen is designed for generating Yesod code, including templates So
-- it uses different interpolation characters that won't clash with
-- templates. You can use the normal text quasiquoters to generate code
codegen :: QuasiQuoter
-- | Generates strict Text codegen is designed for generating Yesod code,
-- including templates So it uses different interpolation characters that
-- won't clash with templates.
codegenSt :: QuasiQuoter
codegenFile :: FilePath -> Q Exp
codegenFileReload :: FilePath -> Q Exp
instance Text.Shakespeare.Text.ToText Data.Text.Internal.Builder.Builder
instance Text.Shakespeare.Text.ToText [GHC.Types.Char]
instance Text.Shakespeare.Text.ToText Data.Text.Internal.Text
instance Text.Shakespeare.Text.ToText Data.Text.Internal.Lazy.Text
instance Text.Shakespeare.Text.ToText GHC.Int.Int32
instance Text.Shakespeare.Text.ToText GHC.Int.Int64
instance Text.Shakespeare.Text.ToText GHC.Types.Int
-- | A Shakespearean module for Javascript templates, introducing
-- type-safe, compile-time variable and url interpolation.--
--
-- You might consider trying <a>Typescript</a> or <a>Coffee</a> which
-- compile down to Javascript.
--
-- Further reading:
-- <a>http://www.yesodweb.com/book/shakespearean-templates</a>
module Text.Julius
js :: QuasiQuoter
julius :: QuasiQuoter
juliusFile :: FilePath -> Q Exp
jsFile :: FilePath -> Q Exp
-- | <i>Deprecated: Please use juliusFileReload instead.</i>
juliusFileDebug :: FilePath -> Q Exp
-- | <i>Deprecated: Please use jsFileReload instead.</i>
jsFileDebug :: FilePath -> Q Exp
juliusFileReload :: FilePath -> Q Exp
jsFileReload :: FilePath -> Q Exp
-- | Return type of template-reading functions.
type JavascriptUrl url = (url -> [(Text, Text)] -> Text) -> Javascript
-- | Newtype wrapper of <a>Builder</a>.
newtype Javascript
Javascript :: Builder -> Javascript
[unJavascript] :: Javascript -> Builder
newtype RawJavascript
RawJavascript :: Builder -> RawJavascript
-- | A typeclass for types that can be interpolated in CoffeeScript
-- templates.
class ToJavascript a
toJavascript :: ToJavascript a => a -> Javascript
class RawJS a
rawJS :: RawJS a => a -> RawJavascript
renderJavascript :: Javascript -> Text
-- | render with route interpolation. If using this module standalone,
-- apart from type-safe routes, a dummy renderer can be used:
--
-- <pre>
-- renderJavascriptUrl (\_ _ -> undefined) javascriptUrl
-- </pre>
--
-- When using Yesod, a renderer is generated for you, which can be
-- accessed within the GHandler monad: <a>getUrlRenderParams</a>.
renderJavascriptUrl :: (url -> [(Text, Text)] -> Text) -> JavascriptUrl url -> Text
javascriptSettings :: Q ShakespeareSettings
-- | Determine which identifiers are used by the given template, useful for
-- creating systems like yesod devel.
juliusUsedIdentifiers :: String -> [(Deref, VarType)]
asJavascriptUrl :: JavascriptUrl url -> JavascriptUrl url
instance GHC.Base.Monoid Text.Julius.Javascript
instance Text.Julius.ToJavascript GHC.Types.Bool
instance Text.Julius.ToJavascript Data.Aeson.Types.Internal.Value
instance Text.Julius.ToJavascript Text.Julius.RawJavascript
instance Text.Julius.RawJS [GHC.Types.Char]
instance Text.Julius.RawJS Data.Text.Internal.Text
instance Text.Julius.RawJS Data.Text.Internal.Lazy.Text
instance Text.Julius.RawJS Data.Text.Internal.Builder.Builder
instance Text.Julius.RawJS GHC.Types.Bool
-- | A Shakespearean module for Roy, introducing type-safe, compile-time
-- variable and url interpolation. It is exactly the same as
-- <a>Text.Julius</a>, except that the template is first compiled to
-- Javascript with the system tool <tt>roy</tt>.
--
-- To use this module, <tt>roy</tt> must be installed on your system.
--
-- If you interpolate variables, the template is first wrapped with a
-- function containing javascript variables representing shakespeare
-- variables, then compiled with <tt>roy</tt>, and then the value of the
-- variables are applied to the function. This means that in production
-- the template can be compiled once at compile time and there will be no
-- dependency in your production system on <tt>roy</tt>.
--
-- Your code:
--
-- <pre>
-- let b = 1
-- console.log(#{a} + b)
-- </pre>
--
-- Final Result:
--
-- <pre>
-- ;(function(shakespeare_var_a){
-- var b = 1;
-- console.log(shakespeare_var_a + b);
-- })(#{a});
-- </pre>
--
-- Further reading:
--
-- <ol>
-- <li>Shakespearean templates:
-- <a>http://www.yesodweb.com/book/templates</a></li>
-- <li>Roy: <a>http://roy.brianmckenna.org/</a></li>
-- </ol>
module Text.Roy
-- | Read inline, quasiquoted Roy.
roy :: QuasiQuoter
-- | Read in a Roy template file. This function reads the file once, at
-- compile time.
royFile :: FilePath -> Q Exp
-- | Read in a Roy template file. This impure function uses unsafePerformIO
-- to re-read the file on every call, allowing for rapid iteration.
royFileReload :: FilePath -> Q Exp
-- | A Shakespearean module for CoffeeScript, introducing type-safe,
-- compile-time variable and url interpolation. It is exactly the same as
-- <a>Text.Julius</a>, except that the template is first compiled to
-- Javascript with the system tool <tt>coffee</tt>.
--
-- To use this module, <tt>coffee</tt> must be installed on your system.
--
-- <tt>#{...}</tt> is the Shakespearean standard for variable
-- interpolation, but CoffeeScript already uses that sequence for string
-- interpolation. Therefore, Shakespearean interpolation is introduced
-- with <tt>%{...}</tt>.
--
-- If you interpolate variables, the template is first wrapped with a
-- function containing javascript variables representing shakespeare
-- variables, then compiled with <tt>coffee</tt>, and then the value of
-- the variables are applied to the function. This means that in
-- production the template can be compiled once at compile time and there
-- will be no dependency in your production system on <tt>coffee</tt>.
--
-- Your code:
--
-- <pre>
-- b = 1
-- console.log(#{a} + b)
-- </pre>
--
-- Function wrapper added to your coffeescript code:
--
-- <pre>
-- ((shakespeare_var_a) =>
-- b = 1
-- console.log(shakespeare_var_a + b)
-- )
-- </pre>
--
-- This is then compiled down to javascript, and the variables are
-- applied:
--
-- <pre>
-- ;(function(shakespeare_var_a){
-- var b = 1;
-- console.log(shakespeare_var_a + b);
-- })(#{a});
-- </pre>
--
-- Further reading:
--
-- <ol>
-- <li>Shakespearean templates:
-- <a>http://www.yesodweb.com/book/templates</a></li>
-- <li>CoffeeScript: <a>http://coffeescript.org/</a></li>
-- </ol>
module Text.Coffee
-- | Read inline, quasiquoted CoffeeScript.
coffee :: QuasiQuoter
-- | Read in a CoffeeScript template file. This function reads the file
-- once, at compile time.
coffeeFile :: FilePath -> Q Exp
-- | Read in a CoffeeScript template file. This impure function uses
-- unsafePerformIO to re-read the file on every call, allowing for rapid
-- iteration.
coffeeFileReload :: FilePath -> Q Exp
-- | Deprecated synonym for <a>coffeeFileReload</a>
-- | <i>Deprecated: Please use coffeeFileReload instead.</i>
coffeeFileDebug :: FilePath -> Q Exp
module Text.Lucius
-- | <pre>
-- >>> renderCss ([lucius|foo{bar:baz}|] undefined)
-- "foo{bar:baz}"
-- </pre>
lucius :: QuasiQuoter
luciusFile :: FilePath -> Q Exp
luciusFileDebug :: FilePath -> Q Exp
luciusFileReload :: FilePath -> Q Exp
luciusMixin :: QuasiQuoter
data Mixin
luciusRT :: Text -> [(Text, Text)] -> Either String Text
luciusRT' :: Text -> Either String ([(Text, Text)] -> Either String [TopLevel Resolved])
-- | Same as <a>luciusRT</a>, but output has no added whitespace.
--
-- Since 1.0.3
luciusRTMinified :: Text -> [(Text, Text)] -> Either String Text
-- | Runtime Lucius with mixin support.
--
-- Since 1.0.6
luciusRTMixin :: Text -> Bool -> [(Text, RTValue)] -> Either String Text
data RTValue
RTVRaw :: Text -> RTValue
RTVMixin :: Mixin -> RTValue
data Css
type CssUrl url = (url -> [(Text, Text)] -> Text) -> Css
class ToCss a
toCss :: ToCss a => a -> Builder
renderCss :: Css -> Text
renderCssUrl :: (url -> [(Text, Text)] -> Text) -> CssUrl url -> Text
data Color
Color :: Word8 -> Word8 -> Word8 -> Color
colorRed :: Color
colorBlack :: Color
-- | Create a CSS size, e.g. $(mkSize "100px").
mkSize :: String -> ExpQ
-- | Absolute size units.
data AbsoluteUnit
Centimeter :: AbsoluteUnit
Inch :: AbsoluteUnit
Millimeter :: AbsoluteUnit
Pica :: AbsoluteUnit
Point :: AbsoluteUnit
-- | Not intended for direct use, see <a>mkSize</a>.
data AbsoluteSize
AbsoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize
-- | Units used for text formatting.
[absoluteSizeUnit] :: AbsoluteSize -> AbsoluteUnit
-- | Normalized value in centimeters.
[absoluteSizeValue] :: AbsoluteSize -> Rational
-- | Constructs <a>AbsoluteSize</a>. Not intended for direct use, see
-- <a>mkSize</a>.
absoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize
data EmSize
EmSize :: Rational -> EmSize
data ExSize
ExSize :: Rational -> ExSize
-- | Not intended for direct use, see <a>mkSize</a>.
data PercentageSize
PercentageSize :: Rational -> PercentageSize
-- | Normalized value, 1 == 100%.
[percentageSizeValue] :: PercentageSize -> Rational
-- | Constructs <a>PercentageSize</a>. Not intended for direct use, see
-- <a>mkSize</a>.
percentageSize :: Rational -> PercentageSize
data PixelSize
PixelSize :: Rational -> PixelSize
parseTopLevels :: Parser [TopLevel Unresolved]
-- | Determine which identifiers are used by the given template, useful for
-- creating systems like yesod devel.
luciusUsedIdentifiers :: String -> [(Deref, VarType)]
module Text.Cassius
data Css
type CssUrl url = (url -> [(Text, Text)] -> Text) -> Css
class ToCss a
toCss :: ToCss a => a -> Builder
renderCss :: Css -> Text
renderCssUrl :: (url -> [(Text, Text)] -> Text) -> CssUrl url -> Text
cassius :: QuasiQuoter
cassiusFile :: FilePath -> Q Exp
cassiusFileDebug :: FilePath -> Q Exp
cassiusFileReload :: FilePath -> Q Exp
-- | Create a mixin with Cassius syntax.
--
-- Since 2.0.3
cassiusMixin :: QuasiQuoter
data Mixin
data Color
Color :: Word8 -> Word8 -> Word8 -> Color
colorRed :: Color
colorBlack :: Color
-- | Create a CSS size, e.g. $(mkSize "100px").
mkSize :: String -> ExpQ
-- | Absolute size units.
data AbsoluteUnit
Centimeter :: AbsoluteUnit
Inch :: AbsoluteUnit
Millimeter :: AbsoluteUnit
Pica :: AbsoluteUnit
Point :: AbsoluteUnit
-- | Not intended for direct use, see <a>mkSize</a>.
data AbsoluteSize
AbsoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize
-- | Units used for text formatting.
[absoluteSizeUnit] :: AbsoluteSize -> AbsoluteUnit
-- | Normalized value in centimeters.
[absoluteSizeValue] :: AbsoluteSize -> Rational
-- | Constructs <a>AbsoluteSize</a>. Not intended for direct use, see
-- <a>mkSize</a>.
absoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize
data EmSize
EmSize :: Rational -> EmSize
data ExSize
ExSize :: Rational -> ExSize
-- | Not intended for direct use, see <a>mkSize</a>.
data PercentageSize
PercentageSize :: Rational -> PercentageSize
-- | Normalized value, 1 == 100%.
[percentageSizeValue] :: PercentageSize -> Rational
-- | Constructs <a>PercentageSize</a>. Not intended for direct use, see
-- <a>mkSize</a>.
percentageSize :: Rational -> PercentageSize
data PixelSize
PixelSize :: Rational -> PixelSize
-- | Determine which identifiers are used by the given template, useful for
-- creating systems like yesod devel.
cassiusUsedIdentifiers :: String -> [(Deref, VarType)]
-- | A Shakespearean module for TypeScript, introducing type-safe,
-- compile-time variable and url interpolation. It is exactly the same as
-- <a>Text.Julius</a>, except that the template is first compiled to
-- Javascript with the system tool <tt>tsc</tt>.
--
-- To use this module, <tt>tsc</tt> must be installed on your system.
--
-- If you interpolate variables, the template is first wrapped with a
-- function containing javascript variables representing shakespeare
-- variables, then compiled with <tt>tsc</tt>, and then the value of the
-- variables are applied to the function. This means that in production
-- the template can be compiled once at compile time and there will be no
-- dependency in your production system on <tt>tsc</tt>.
--
-- Your code:
--
-- <pre>
-- var b = 1
-- console.log(#{a} + b)
-- </pre>
--
-- Final Result:
--
-- <pre>
-- ;(function(shakespeare_var_a){
-- var b = 1;
-- console.log(shakespeare_var_a + b);
-- })(#{a});
-- </pre>
--
-- Important Warnings! This integration is not ideal.
--
-- Due to the function wrapper, all type declarations must be in separate
-- .d.ts files. However, if you don't interpolate variables, no function
-- wrapper will be created, and you can make type declarations in the
-- same file.
--
-- This does not work cross-platform!
--
-- Unfortunately tsc does not support stdin and stdout. So a hack of
-- writing to temporary files using the mktemp command is used. This
-- works on my version of Linux, but not for windows unless perhaps you
-- install a mktemp utility, which I have not tested. Please vote up this
-- bug: <a>http://typescript.codeplex.com/workitem/600</a>
--
-- Making this work on Windows would not be very difficult, it will just
-- require a new package with a dependency on a package like temporary.
--
-- Further reading:
--
-- <ol>
-- <li>Shakespearean templates:
-- <a>http://www.yesodweb.com/book/templates</a></li>
-- <li>TypeScript: <a>http://typescript.codeplex.com/</a></li>
-- </ol>
module Text.TypeScript
-- | Read inline, quasiquoted TypeScript
tsc :: QuasiQuoter
-- | Read in a TypeScript template file. This function reads the file once,
-- at compile time.
typeScriptFile :: FilePath -> Q Exp
-- | Read in a TypeScript template file. This impure function uses
-- unsafePerformIO to re-read the file on every call, allowing for rapid
-- iteration.
typeScriptFileReload :: FilePath -> Q Exp
|