X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FResource%2FTree.hs;h=cef168cb522322e80bdbb164a68f3e2db678f3a5;hp=2cd498f7ade7c7f4e5435d2344e161a5717cf65e;hb=3d017dd65ddede9a11c5b7a34a91e04340e67bc4;hpb=e1e74c8f81ccbc57bf5a09987b0a9dd42648f020 diff --git a/Network/HTTP/Lucu/Resource/Tree.hs b/Network/HTTP/Lucu/Resource/Tree.hs index 2cd498f..cef168c 100644 --- a/Network/HTTP/Lucu/Resource/Tree.hs +++ b/Network/HTTP/Lucu/Resource/Tree.hs @@ -31,7 +31,7 @@ import Network.HTTP.Lucu.Resource import Network.HTTP.Lucu.Response import Network.HTTP.Lucu.Interaction import Network.HTTP.Lucu.Utils -import Network.URI +import Network.URI hiding (path) import System.IO import System.IO.Error hiding (catch) import Prelude hiding (catch) @@ -114,7 +114,7 @@ data ResNode = ResNode !(Maybe ResourceDef) !ResSubtree -- ] -- @ mkResTree :: [ ([String], ResourceDef) ] -> ResTree -mkResTree list = list `seq` processRoot list +mkResTree xs = xs `seq` processRoot xs where processRoot :: [ ([String], ResourceDef) ] -> ResTree processRoot list @@ -166,14 +166,14 @@ findResource (ResTree (ResNode rootDefM subtree)) fbs uri where walkTree :: ResSubtree -> [String] -> [String] -> Maybe ([String], ResourceDef) - walkTree subtree (name:[]) soFar - = case M.lookup name subtree of + walkTree tree (name:[]) soFar + = case M.lookup name tree of Nothing -> Nothing Just (ResNode defM _) -> do def <- defM return (soFar ++ [name], def) - walkTree subtree (x:xs) soFar - = case M.lookup x subtree of + walkTree tree (x:xs) soFar + = case M.lookup x tree of Nothing -> Nothing Just (ResNode defM children) -> case defM of Just (ResourceDef { resIsGreedy = True }) @@ -215,6 +215,7 @@ runResource def itr POST -> resPost def PUT -> resPut def DELETE -> resDelete def + _ -> undefined notAllowed :: Resource () notAllowed = do setStatus MethodNotAllowed @@ -239,7 +240,7 @@ runResource def itr ErrorCall msg -> Abortion InternalServerError emptyHeaders $ Just msg IOException ioE -> Abortion InternalServerError emptyHeaders $ Just $ formatIOE ioE DynException dynE -> case fromDynamic dynE of - Just (abo :: Abortion) -> abo + Just (a :: Abortion) -> a Nothing -> Abortion InternalServerError emptyHeaders $ Just $ show exc