Created
March 2, 2015 15:32
-
-
Save notcome/c64b095f10d44440c755 to your computer and use it in GitHub Desktop.
Human readable Haskell representation for "Quick Quote"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
{-# LANGUAGE UnicodeSyntax #-} | |
import Prelude hiding (putStrLn) | |
import Data.Text.Lazy.IO (putStrLn) | |
import Control.Monad.Writer | |
-- Monoid Instance -- | |
import Text.Blaze.Internal () | |
import qualified Text.Blaze.Html5 as H | |
import qualified Text.Blaze.Html5.Attributes as A | |
import Text.Blaze.Html.Renderer.Text | |
writeHtml = renderHtml . execWriter | |
par = tell . H.p | |
infixl 3 <* | |
infixl 5 <<* | |
infixr 4 *>> | |
infixr 2 *> | |
a <* b = a <> H.span b | |
a <<* b = a <> H.span b | |
(*>) = (<>) | |
(*>>) = (<>) | |
main = do | |
let result = writeHtml $ do | |
par $ "thread"<*"线程"*>"是……" | |
par $ "thread"<*"线程"<<*"或"<>H.span "duang"*>>"线程"*>"是……" | |
putStrLn result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment