diff --git a/src/Application.hs b/src/Application.hs index 86d719a..c617cd3 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -1,3 +1,25 @@ +{-| + +Module : Application +Copyright : Jonathan Lamothe +License : GPL-3 +Maintainer : jonathan@jlamothe.net + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +-} + {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} @@ -104,10 +126,7 @@ warpSettings foundation = -- | For yesod devel, return the Warp settings and WAI Application. getApplicationDev :: IO (Settings, Application) getApplicationDev = do - settings <- getAppSettings - foundation <- makeFoundation settings - wsettings <- getDevSettings $ warpSettings foundation - app <- makeApplication foundation + (_, wsettings, app) <- getSettings return (wsettings, app) getAppSettings :: IO AppSettings @@ -143,10 +162,7 @@ appMain = do -------------------------------------------------------------- getApplicationRepl :: IO (Int, App, Application) getApplicationRepl = do - settings <- getAppSettings - foundation <- makeFoundation settings - wsettings <- getDevSettings $ warpSettings foundation - app1 <- makeApplication foundation + (foundation, wsettings, app1) <- getSettings return (getPort wsettings, foundation, app1) shutdownApp :: App -> IO () @@ -160,3 +176,13 @@ shutdownApp _ = return () -- | Run a handler handler :: Handler a -> IO a handler h = getAppSettings >>= makeFoundation >>= flip unsafeHandler h + +getSettings :: IO (App, Settings, Application) +getSettings = do + settings <- getAppSettings + foundation <- makeFoundation settings + wsettings <- getDevSettings $ warpSettings foundation + app <- makeApplication foundation + return (foundation, wsettings, app) + +--jl diff --git a/test/TestImport.hs b/test/TestImport.hs index 91dd7db..1aa766d 100644 --- a/test/TestImport.hs +++ b/test/TestImport.hs @@ -1,4 +1,24 @@ -{-# LANGUAGE QuasiQuotes #-} +{- + +dmfix + +Copyright (C) Jonathan Lamothe + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +-} + {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} module TestImport @@ -29,3 +49,5 @@ withApp = before $ do foundation <- makeFoundation settings logWare <- liftIO $ makeLogWare foundation return (foundation, logWare) + +--jl