X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FResource%2FTree.hs;h=4cb493274859cd7aa4fb56ca4664123dff0d5867;hb=refs%2Ftags%2FRELEASE-0_4_1;hp=660d8ff735bdc3f2fab18f7d42ab8a1f8951a091;hpb=195fd2318fb0ad21c2fd60f61e7df72a8f25d12c;p=Lucu.git diff --git a/Network/HTTP/Lucu/Resource/Tree.hs b/Network/HTTP/Lucu/Resource/Tree.hs index 660d8ff..4cb4932 100644 --- a/Network/HTTP/Lucu/Resource/Tree.hs +++ b/Network/HTTP/Lucu/Resource/Tree.hs @@ -15,6 +15,7 @@ module Network.HTTP.Lucu.Resource.Tree ) where +import Control.Arrow import Control.Concurrent import Control.Concurrent.STM import Control.Exception @@ -140,13 +141,10 @@ data ResNode = ResNode (Maybe ResourceDef) ResSubtree -- ] -- @ mkResTree :: [ ([String], ResourceDef) ] -> ResTree -mkResTree = processRoot . mapFirst canonicalisePath +mkResTree = processRoot . map (first canonicalisePath) where - mapFirst :: (a -> a') -> [(a, b)] -> [(a', b)] - mapFirst f = map (\ (a, b) -> (f a, b)) - canonicalisePath :: [String] -> [String] - canonicalisePath = filter (\ x -> x /= "") + canonicalisePath = filter (/= "") processRoot :: [ ([String], ResourceDef) ] -> ResTree processRoot list