packages feed

loli 2009.8.16 → 2009.8.18

raw patch · 7 files changed

+33/−50 lines, 7 filesdep ~hackdep ~hack-contribdep ~mpsPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: hack, hack-contrib, mps

API changes (from Hackage documentation)

- Network.Loli.Middleware.IOConfig: ioconfig :: (Env -> IO Env) -> Middleware
- Network.Loli.Middleware.UserMime: user_mime :: [(String, String)] -> Middleware

Files

changelog.md view
@@ -1,3 +1,10 @@+2009.8.18+---------++### Feature++* use new hack-contrib+ 2009.8.16 --------- 
loli.cabal view
@@ -1,5 +1,5 @@ Name:                 loli-Version:              2009.8.16+Version:              2009.8.18 Build-type:           Simple Synopsis:             A minimum web dev DSL in Haskell Description:@@ -18,16 +18,14 @@  library   ghc-options: -Wall-  build-depends: base > 4 && <= 5, data-default, hack >= 2009.5.19, hack-contrib >= 2009.6.25, utf8-string, mps >= 2009.6.25, mtl, containers, template, bytestring+  build-depends: base > 4 && <= 5, data-default, hack >= 2009.7.15, hack-contrib >= 2009.8.18, utf8-string, mps >= 2009.8.18.1, mtl, containers, template, bytestring   hs-source-dirs: src/   exposed-modules:                         Network.Loli                       Network.Loli.Config                       Network.Loli.DSL                       Network.Loli.Engine-                      Network.Loli.Middleware.IOConfig                       Network.Loli.Middleware.LoliRouter-                      Network.Loli.Middleware.UserMime                       Network.Loli.Template                       Network.Loli.Template.ConstTemplate                       Network.Loli.Template.TextTemplate
readme.md view
@@ -10,8 +10,10 @@          import Network.Loli     import Hack.Handler.Happstack+    import MPS.Light ((-))+    import Prelude hiding ((-))     -    main = run . loli $ get "/" (text "loli power")+    main = run . loli - get "/" (text "loli power")  Install and compile: @@ -29,21 +31,21 @@  ### Verbs -    get "/" $ do+    get "/" - do       -- something for a get request -    post "/" $ do+    post "/" - do       -- for a post request     -    put "/" $ do+    put "/" - do       -- put ..     -    delete "/" $ do+    delete "/" - do       -- ..  ### Captures -    get "/say/:user/:message" $ do+    get "/say/:user/:message" - do       text . show =<< captures      -- /say/jinjing/hello will output@@ -66,7 +68,7 @@      import Network.Loli.Template.TextTemplate     -    get "/hi/:user" $ output (text_template "hello.html")+    get "/hi/:user" - output (text_template "hello.html")          -- in hello.html     <html>@@ -78,13 +80,13 @@  ### Local binding -    get "/local-binding" $ do-      bind "user" "alice" $ output (text_template "hello.html")+    get "/local-binding" - do+      bind "user" "alice" - output (text_template "hello.html")  ### Batched local bindings -    get "/batched-local-binding" $ do-      context [("user", "alice"), ("password", "foo")] $ +    get "/batched-local-binding" - do+      context [("user", "alice"), ("password", "foo")] -          text . show =<< locals  ## Partials@@ -95,24 +97,24 @@      import Network.Loli.Template.ConstTemplate -    get "/single-partial" $ do-      partial "user" (const_template "const-user") $ do+    get "/single-partial" - do+      partial "user" (const_template "const-user") - do         text . show =<< template_locals  ### with batched partials -    get "/group-partial" $ do+    get "/group-partial" - do       partials          [ ("user", const_template "alex")         , ("password", const_template "foo")-        ] $ output (text_template "hello.html")+        ] - output (text_template "hello.html")  ## Layout  ### Local -    get "/with-layout" $ do-      with_layout "layout.html" $ do+    get "/with-layout" - do+      with_layout "layout.html" - do         text "layout?"          -- in layout.html@@ -129,8 +131,8 @@  ### By passed -    get "/no-layout" $ do-      no_layout $ do+    get "/no-layout" - do+      no_layout - do         text "no-layout"  @@ -142,7 +144,7 @@ ## Filters      -- before takes a function of type (Env -> IO Env)-    before $ \e -> do+    before - \e -> do       putStrLn "before called"       return e     
src/Network/Loli/DSL.hs view
@@ -5,16 +5,15 @@ import Hack import Hack.Contrib.Middleware.Censor import Hack.Contrib.Middleware.Config+import Hack.Contrib.Middleware.IOConfig import Hack.Contrib.Middleware.Static import MPS import Network.Loli.Config import Network.Loli.Engine-import Network.Loli.Middleware.IOConfig import Network.Loli.Type import Network.Loli.Utils import Prelude hiding ((.), (>), (^), (-)) import qualified Control.Monad.State as State-  app :: Application -> AppUnit app f = ask >>= (f > io) >>= State.put
src/Network/Loli/Engine.hs view
@@ -7,11 +7,11 @@ import Data.Default import Hack import Hack.Contrib.Middleware.NotFound+import Hack.Contrib.Middleware.UserMime import Hack.Contrib.Utils hiding (get, put) import MPS import Network.Loli.Config import Network.Loli.Middleware.LoliRouter ()-import Network.Loli.Middleware.UserMime import Network.Loli.Type import Network.Loli.Utils import Prelude hiding ((.), (/), (>), (^), (-))
− src/Network/Loli/Middleware/IOConfig.hs
@@ -1,6 +0,0 @@-module Network.Loli.Middleware.IOConfig (ioconfig) where--import Hack--ioconfig :: (Env -> IO Env) -> Middleware-ioconfig before app = \env -> before env >>= app
− src/Network/Loli/Middleware/UserMime.hs
@@ -1,17 +0,0 @@-module Network.Loli.Middleware.UserMime (user_mime) where--import Data.List (find)-import Hack-import Hack.Contrib.Response-import Hack.Contrib.Utils-import MPS.Light-import Prelude hiding ((.), (-))---user_mime :: [(String, String)] -> Middleware-user_mime h app env = do-  r <- app env-  case h.only_fst.find mime >>= flip lookup h of-    Nothing -> return r-    Just v -> return - r.set_content_type v-  where mime x = env.path_info.ends_with ('.' : x)