simple 0.10.0.3 → 0.10.1
raw patch · 3 files changed
+13/−5 lines, 3 filesdep ~monad-control
Dependency ranges changed: monad-control
Files
- simple.cabal +2/−2
- src/Web/Simple/Controller/Trans.hs +3/−3
- src/Web/Simple/Static.hs +8/−0
simple.cabal view
@@ -1,5 +1,5 @@ name: simple-version: 0.10.0.3+version: 0.10.1 synopsis: A minimalist web framework for the WAI server interface description: @@ -67,7 +67,7 @@ , directory , filepath , mime-types- , monad-control < 0.4+ , monad-control >= 1.0.0.0 , mtl , simple-templates >= 0.7.0 , wai >= 3.0
src/Web/Simple/Controller/Trans.hs view
@@ -99,11 +99,11 @@ liftBase = liftBaseDefault instance MonadBaseControl m m => MonadBaseControl m (ControllerT s m) where- newtype StM (ControllerT s m) a = StCtrl (Either Response a, s)+ type StM (ControllerT s m) a = (Either Response a, s) liftBaseWith fn = ControllerT $ \st req -> do- res <- fn $ \act -> liftM StCtrl $ runController act st req+ res <- fn $ \act -> runController act st req return (Right res, st)- restoreM (StCtrl (a, s)) = ControllerT $ \_ _ -> return (a, s)+ restoreM (a, s) = ControllerT $ \_ _ -> return (a, s) hoistEither :: Monad m => Either Response a -> ControllerT s m a hoistEither eith = ControllerT $ \st _ -> return (eith, st)
src/Web/Simple/Static.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE OverloadedStrings #-} module Web.Simple.Static where import Control.Monad@@ -19,4 +20,11 @@ respond $ responseFile status200 [(hContentType, defaultMimeLookup $ T.pack $ takeFileName fp)] fp Nothing+ when (null $ takeExtension fp) $ do+ let fpIdx = fp </> "index.html"+ existsIdx <- liftIO $ doesFileExist fpIdx+ when existsIdx $ do+ respond $ responseFile status200+ [(hContentType, "text/html")]+ fpIdx Nothing