[working on monoid instance for ServerPartT thomashartman1@gmail.com**20080620211122] hunk ./src/ControllerBasic.hs 32 -simpleHandlers = debugFilter [ +simpleHandlers = {- debugFilter -} [ hunk ./src/ControllerBasic.hs 36 - if ru == "simpleRequestHandler1" - then ( ( return . toResponse ) "matched simpleRequestHandler1" :: TutWebT) - else noHandle + if ru == "/helloworld" + then ( ( return . toResponse ) "hello world, this is HAppS" :: TutWebT) + else noHandle, hunk ./src/ControllerBasic.hs 40 - , exactdir "simpleRequestHandler2" [ msgToSp "simpleRequesthandler2" ] + h1,h2,hmulti + -- ,hsequence + + + , exactdir "simpleRequestHandler2" [ msgToSp "simpleRequesthandler2" ] hunk ./src/ControllerBasic.hs 49 - , (exactdir "ioaction" + , (exactdir "/ioaction" hunk ./src/ControllerBasic.hs 77 +h1 = simplematch "1" +h2 = simplematch "2" +hmulti = multi [simplematch "3", simplematch "4"] +hsequence = sequence [simplematch "5",simplematch "6"] + +simplematch u = ServerPartT $ \rq -> do + ru <- (return . rqURL) rq + if (traceMsg "ru: " ru) == ( traceMsg "sm: " $ "/simplematch" ++ u) + then ( ( return . toResponse ) ( "matched " ++ u) :: TutWebT ) + else noHandle + + hunk ./src/Misc.hs 11 +import Data.Monoid hunk ./src/Misc.hs 24 - = ServerPartT $ \rq -> if ( (rqURL rq) == staticPath) + = ServerPartT $ \rq -> if ( rqURL rq == staticPath ) hunk ./src/Misc.hs 48 + +instance Monoid (ServerPartT IO (Result a) ) + where mempty = ServerPartT $ \rq -> noHandle + mappend (ServerPartT sp1) (ServerPartT sp2) = ServerPartT $ \rq -> + do res <- sp1 rq + case res of + NoHandle -> sp2 rq + _ -> return res + hunk ./templates/basic-url-handling.st 17 +