packages feed

loli 2009.8.18 → 2009.10.13

raw patch · 6 files changed

+43/−21 lines, 6 filesdep ~mpsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: mps

API changes (from Hackage documentation)

Files

LICENSE view
@@ -1,9 +1,31 @@ Copyright (c) 2009, Jinjing Wang+ All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:+Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met: -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.-Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.-Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Jinjing Wang nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
changelog.md view
@@ -1,3 +1,10 @@+2009.10.13+----------++### Fix++* compatible with lastest mps+ 2009.8.18 --------- 
loli.cabal view
@@ -1,5 +1,5 @@ Name:                 loli-Version:              2009.8.18+Version:              2009.10.13 Build-type:           Simple Synopsis:             A minimum web dev DSL in Haskell Description:@@ -18,7 +18,7 @@  library   ghc-options: -Wall-  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+  build-depends: base > 4 && <= 5, data-default, hack >= 2009.7.15, hack-contrib >= 2009.8.18, utf8-string, mps >= 2009.9.18, mtl, containers, template, bytestring   hs-source-dirs: src/   exposed-modules:                         Network.Loli
src/Network/Loli/Engine.hs view
@@ -6,8 +6,8 @@ import Control.Monad.State hiding (join) import Data.Default import Hack-import Hack.Contrib.Middleware.NotFound import Hack.Contrib.Middleware.UserMime+import Hack.Contrib.Middleware.NotFound import Hack.Contrib.Utils hiding (get, put) import MPS import Network.Loli.Config@@ -20,8 +20,9 @@ run_app unit = \env -> runReaderT unit env .flip execStateT def {status = 200}  loli :: Unit -> Application-loli unit = run unit (not_found empty_app)+loli unit = run unit not_found_app   where+    not_found_app = not_found dummy_app     run_route x = (x.router) loli_captures run_app (x.route_path)          run :: Unit -> Middleware
src/Network/Loli/Middleware/LoliRouter.hs view
@@ -7,6 +7,7 @@ import MPS import Prelude hiding ((.), (>), (/), (-)) import Data.ByteString.UTF8 (fromString)+import qualified Prelude as P   type RoutePathT a = (RequestMethod, String, a)@@ -15,19 +16,12 @@  loli_router :: String -> (a -> Application) -> RoutePathT a -> Middleware loli_router prefix runner route_path app = \env ->-  let path             = env.path_info-      script           = env.script_name-      mod_env location = env -        { scriptName  = script ++ location-        , pathInfo    = path.drop (location.length)-        }-  in   if route_path.match_route env.not     then app env     else do       let (_, template, app_state) = route_path-          (location, params) = parse_params template path .fromJust-      runner app_state (mod_env location .merge_captured params)+          (_, params) = parse_params template (env.path_info) .fromJust+      runner app_state (env .merge_captured params)   where     match_route env' (method, template, _) =        env'.request_method.is method @@ -46,7 +40,7 @@   let template_tokens = t.split "/"       url_tokens      = s.split "/"   in-  if url_tokens.length < template_tokens.length+  if url_tokens.length P.< template_tokens.length     then Nothing     else        let rs = zipWith capture template_tokens url_tokens
src/Test/Test.hs view
@@ -1,6 +1,5 @@ import Control.Monad.Reader import Hack.Contrib.Response-import Hack.Contrib.Middleware.Lambda import Hack.Handler.SimpleServer -- import Hack.Handler.Happstack import Network.Loli@@ -19,7 +18,6 @@ main :: IO () main = run 3000 . loli - do   -    middleware lambda          before return     after return