Permalink
Browse files

Updated example

  • Loading branch information...
1 parent 94b4f92 commit a5dc2c5d78cfb73c86050f947177d5f4bc5f5924 @MedeaMelana committed Jun 19, 2011
Showing with 9 additions and 8 deletions.
  1. +9 −8 ExampleTH.hs
View
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonoPatBinds #-}
import Web.Zwaluw
import Web.Zwaluw.TH
@@ -13,22 +14,22 @@ import Control.Category
data Sitemap
= Home
- | UserOverview
- | UserDetail Int
- | Article Int String
+ | CatOverview
+ | CatDetail Int
+ | Product Int String
deriving (Eq, Show)
-$(deriveRouters ''Sitemap)
+(rHome, rCatOverview, rCatDetail, rProduct) = $(deriveRouterTuple ''Sitemap)
-- The router. Specifies how to parse a URL into a Sitemap and back.
sitemap :: Router r (Sitemap :- r)
sitemap = id /
( rHome
- <> "users" . users
- <> rArticle . ("article" / int . "-" . part)
+ <> "categories" . cats
+ <> rProduct . ("product" / int . "-" . part)
)
where
- users = rUserOverview
- <> rUserDetail / int
+ cats = rCatOverview
+ <> rCatDetail / int

0 comments on commit a5dc2c5

Please sign in to comment.