{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE CPP #-}-- | This module simply re-exports from other modules for your convenience.moduleYesod(-- * Re-exports from yesod-coremoduleYesod.Request,moduleYesod.Content,moduleYesod.Core,moduleYesod.Handler,moduleYesod.Dispatch,moduleYesod.Widget,moduleYesod.Form,moduleYesod.Json,moduleYesod.Persist-- * Running your application,warp,warpDebug,develServer-- * Commonly referenced functions/datatypes,Application,lift,liftIO,MonadPeelIO-- * Utilities,showIntegral,readIntegral-- * Hamlet library-- ** Hamlet,hamlet,xhamlet,Hamlet,Html,renderHamlet,renderHtml,string,preEscapedString,cdata-- ** Julius,julius,Julius,renderJulius-- ** Cassius,cassius,Cassius,renderCassius)whereimportYesod.ContentimportYesod.DispatchimportYesod.CoreimportYesod.Handlerhiding(runHandler)importText.HamletimportText.CassiusimportText.JuliusimportYesod.RequestimportYesod.WidgetimportYesod.FormimportYesod.JsonimportYesod.PersistimportNetwork.Wai(Application)importNetwork.Wai.Middleware.Debug#if !GHC7importNetwork.Wai.Handler.DevelServer(runQuit)#endifimportControl.Monad.Trans.Class(lift)importControl.Monad.IO.Class(liftIO)importControl.Monad.IO.Peel(MonadPeelIO)importNetwork.Wai.Handler.Warp(run)importSystem.IO(stderr,hPutStrLn)importqualifiedData.Text.Lazy.IOasTIOimportqualifiedData.Attoparsec.Text.LazyasAimportControl.Applicative((<|>))importData.Maybe(mapMaybe)importData.Char(isSpace)showIntegral::Integrala=>a->StringshowIntegralx=show(fromIntegralx::Integer)readIntegral::Numa=>String->MaybeareadIntegrals=casereadssof(i,_):_->Just$fromIntegeri[]->Nothing-- | A convenience method to run an application using the Warp webserver on the-- specified port. Automatically calls 'toWaiApp'.warp::(Yesoda,YesodDispatchaa)=>Int->a->IO()warpporta=toWaiAppa>>=runport-- | Same as 'warp', but also sends a message to stderr for each request, and-- an \"application launched\" message as well. Can be useful for development.warpDebug::(Yesoda,YesodDispatchaa)=>Int->a->IO()warpDebugporta=dohPutStrLnstderr$"Application launched, listening on port "++showporttoWaiAppa>>=runport.debug-- | Run a development server, where your code changes are automatically-- reloaded.develServer::Int-- ^ port number->String-- ^ module name holding the code->String-- ^ name of function providing a with-application->IO()#if GHC7develServer=error"Unfortunately, the hint package has not yet been ported to GHC 7, and therefore wai-handler-devel has not either. Once this situation is addressed, a new version of Yesod will be released."#elsedevelServerportmodufunc=domapM_putStrLn["Starting your server process. Code changes will be automatically","loaded as you save your files. Type \"quit\" to exit.","You can view your app at http://localhost:"++showport++"/",""]runQuitportmodufuncdetermineHamletDeps#endifdataTempType=Hamlet|Cassius|Julius|WidgetderivingShow-- | Determine which Hamlet files a Haskell file depends upon.determineHamletDeps::FilePath->IO[FilePath]determineHamletDepsx=doy<-TIO.readFilexletz=A.parse(A.many$(parser<|>(A.anyChar>>returnNothing)))ycasezofA.Fail{}->return[]A.Done_r->return$mapMaybegorwherego(Just(Hamlet,f))=Just$"hamlet/"++f++".hamlet"go(Just(Widget,f))=Just$"hamlet/"++f++".hamlet"go_=Nothingparser=dotyp<-(A.string"$(hamletFile ">>returnHamlet)<|>(A.string"$(cassiusFile ">>returnCassius)<|>(A.string"$(juliusFile ">>returnJulius)<|>(A.string"$(widgetFile ">>returnWidget)<|>(A.string"$(Settings.hamletFile ">>returnHamlet)<|>(A.string"$(Settings.cassiusFile ">>returnCassius)<|>(A.string"$(Settings.juliusFile ">>returnJulius)<|>(A.string"$(Settings.widgetFile ">>returnWidget)A.skipWhileisSpace_<-A.char'"'y<-A.many1$A.satisfy(/='"')_<-A.char'"'A.skipWhileisSpace_<-A.char')'return$Just(typ,y)