b0VIM 7.4Iú„S† ©Ehamchamayonnaise~hamcha/Ketchup/Ketchup/Routing.hsutf-83210#"! Utp)ad½ } )ÝÜŽµ´ˆiJ1  ¨{E%Ë ‹ Š \ G    Ø ® … [ <   Í · e [ J  ì À ¡ } tmpparts = C.split '/' template urlparts = C.split '/' url | otherwise = ("","") | C.head y == ':' = (C.tail y, x) | or [C.null y, C.null x] = ("","") retrieve x y where M.fromList $ filter (not . C.null . fst) $ zipWith retrieve urlparts tmppartsparams url template =params :: C.ByteString -> C.ByteString -> M.Map C.ByteString C.ByteString tmpparts = C.split '/' template urlparts = C.split '/' url | otherwise = False | C.head y == ':' = True | or [C.null y, C.null x] = False | x R.=~ y = True compare x y where and $ zipWith compare urlparts tmppartsmatch url template =match :: C.ByteString -> C.ByteString -> Bool | otherwise = route routes handle request | match (uri request) (fst r) = (snd r) handle request $ params (uri request) (fst r)route (r:routes) handle requestroute [] handle request = sendNotFound handle -> (Socket -> HTTPRequest -> IO ())route :: [(C.ByteString, (Socket -> HTTPRequest -> (M.Map C.ByteString C.ByteString) -> IO ()))]import qualified Text.Regex.Posix as Rimport Networkimport Ketchup.Httpdimport qualified Data.Map as Mimport qualified Data.ByteString.Char8 as C) where( routemodule Ketchup.Routing{-# LANGUAGE OverloadedStrings #-}