{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
module Text.Coffee
(
coffee
, coffeeFile
, coffeeFileReload
, coffeeFileDebug
#ifdef TEST_EXPORT
, coffeeSettings
#endif
) where
import Language.Haskell.TH.Quote (QuasiQuoter (..))
import Language.Haskell.TH.Syntax
import Text.Shakespeare
import Text.Julius
coffeeSettings :: Q ShakespeareSettings
coffeeSettings :: Q ShakespeareSettings
coffeeSettings = do
ShakespeareSettings
jsettings <- Q ShakespeareSettings
javascriptSettings
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ ShakespeareSettings
jsettings { varChar :: Char
varChar = Char
'%'
, preConversion :: Maybe PreConvert
preConversion = forall a. a -> Maybe a
Just PreConvert {
preConvert :: PreConversion
preConvert = String -> [String] -> PreConversion
ReadProcess String
"coffee" [String
"-spb"]
, preEscapeIgnoreBalanced :: String
preEscapeIgnoreBalanced = String
"'\"`"
, preEscapeIgnoreLine :: String
preEscapeIgnoreLine = String
"#"
, wrapInsertion :: Maybe WrapInsertion
wrapInsertion = forall a. a -> Maybe a
Just WrapInsertion {
wrapInsertionIndent :: Maybe String
wrapInsertionIndent = forall a. a -> Maybe a
Just String
" "
, wrapInsertionStartBegin :: String
wrapInsertionStartBegin = String
"("
, wrapInsertionSeparator :: String
wrapInsertionSeparator = String
", "
, wrapInsertionStartClose :: String
wrapInsertionStartClose = String
") =>"
, wrapInsertionEnd :: String
wrapInsertionEnd = String
""
, wrapInsertionAddParens :: Bool
wrapInsertionAddParens = Bool
False
}
}
}
coffee :: QuasiQuoter
coffee :: QuasiQuoter
coffee = QuasiQuoter { quoteExp :: String -> Q Exp
quoteExp = \String
s -> do
ShakespeareSettings
rs <- Q ShakespeareSettings
coffeeSettings
QuasiQuoter -> String -> Q Exp
quoteExp (ShakespeareSettings -> QuasiQuoter
shakespeare ShakespeareSettings
rs) String
s
}
coffeeFile :: FilePath -> Q Exp
coffeeFile :: String -> Q Exp
coffeeFile String
fp = do
ShakespeareSettings
rs <- Q ShakespeareSettings
coffeeSettings
ShakespeareSettings -> String -> Q Exp
shakespeareFile ShakespeareSettings
rs String
fp
coffeeFileReload :: FilePath -> Q Exp
coffeeFileReload :: String -> Q Exp
coffeeFileReload String
fp = do
ShakespeareSettings
rs <- Q ShakespeareSettings
coffeeSettings
ShakespeareSettings -> String -> Q Exp
shakespeareFileReload ShakespeareSettings
rs String
fp
coffeeFileDebug :: FilePath -> Q Exp
coffeeFileDebug :: String -> Q Exp
coffeeFileDebug = String -> Q Exp
coffeeFileReload
{-# DEPRECATED coffeeFileDebug "Please use coffeeFileReload instead." #-}