module Yesod
(
module Yesod.Core
, module Yesod.Form
, module Yesod.Json
, module Yesod.Persist
, warp
, warpDebug
, develServer
, Application
, lift
, liftIO
, MonadControlIO
, showIntegral
, readIntegral
, hamlet
, xhamlet
, HtmlUrl
, Html
, toHtml
, julius
, JavascriptUrl
, renderJavascriptUrl
, cassius
, lucius
, CssUrl
, renderCssUrl
) where
import Yesod.Core
import Text.Hamlet
import Text.Cassius
import Text.Lucius
import Text.Julius
import Yesod.Form
import Yesod.Json
import Yesod.Persist
import Network.Wai (Application)
import Network.Wai.Middleware.Debug
import Control.Monad.Trans.Class (lift)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.IO.Control (MonadControlIO)
import Network.Wai.Handler.Warp (run)
import System.IO (stderr, hPutStrLn)
import Text.Blaze (toHtml)
showIntegral :: Integral a => a -> String
showIntegral x = show (fromIntegral x :: Integer)
readIntegral :: Num a => String -> Maybe a
readIntegral s =
case reads s of
(i, _):_ -> Just $ fromInteger i
[] -> Nothing
warp :: (Yesod a, YesodDispatch a a) => Int -> a -> IO ()
warp port a = toWaiApp a >>= run port
warpDebug :: (Yesod a, YesodDispatch a a) => Int -> a -> IO ()
warpDebug port a = do
hPutStrLn stderr $ "Application launched, listening on port " ++ show port
toWaiApp a >>= run port . debug
develServer :: Int
-> String
-> String
-> IO ()
develServer port modu func =
mapM_ putStrLn
[ "Due to issues with GHC 7.0.2, you must now run the devel server"
, "separately. To do so, ensure you have installed the "
, "wai-handler-devel package >= 0.2.1 and run:"
, concat
[ " wai-handler-devel "
, show port
, " "
, modu
, " "
, func
, " --yesod"
]
, ""
]