[generalize 'CMS' to 'CMS url' Jeremy Shaw **20111108060154 Ignore-this: b2bd01f90a9c4b194c2cd8d8382d8aa9 ] move ./CMSURL.hs ./URL.hs hunk ./Admin/Console.hs 10 -consolePage :: CMS Response +consolePage :: CMS AdminURL Response hunk ./Admin/Console.hs 15 -
+ hunk ./Admin/Console.hs 21 -editList :: [(PageId, Text)] -> GenChildList CMS +editList :: [(PageId, Text)] -> GenChildList (CMS AdminURL) hunk ./Admin/Console.hs 31 - editPageLI :: (PageId, Text) -> GenXML CMS + editPageLI :: (PageId, Text) -> GenXML (CMS AdminURL) hunk ./Admin/Console.hs 33 -
  • <% ttl %>
  • +
  • <% ttl %>
  • hunk ./Admin/EditPage.hs 14 -editPage :: CMSURL -> PageId -> CMS Response +editPage :: SiteURL -> PageId -> CMS SiteURL Response hunk ./Admin/EditPage.hs 23 - updatePage :: Page -> CMS Response + updatePage :: Page -> CMS SiteURL Response hunk ./Admin/EditPage.hs 28 -pageFormlet :: Page -> FormDF CMS Page +pageFormlet :: Page -> FormDF (CMS SiteURL) Page hunk ./Admin/NewPage.hs 7 -newPage :: CMS Response +newPage :: CMS AdminURL Response hunk ./Admin/NewPage.hs 11 - seeOtherURL (Admin $ EditPage (pageId page)) + seeOtherURL (EditPage (pageId page)) hunk ./Admin/Route.hs 9 -routeAdmin :: AdminURL -> CMS Response +routeAdmin :: AdminURL -> CMS SiteURL Response hunk ./Admin/Route.hs 12 - Console -> consolePage + Console -> nestURL Admin $ consolePage hunk ./Admin/Route.hs 14 - NewPage -> newPage + NewPage -> nestURL Admin $ newPage hunk ./Admin/Template.hs 8 - ( EmbedAsChild CMS headers - , EmbedAsChild CMS body - ) => String -> headers -> body -> CMS Response + ( EmbedAsChild (CMS url) headers + , EmbedAsChild (CMS url) body + ) => String -> headers -> body -> CMS url Response hunk ./CMS.hs 9 - , module CMSURL + , module URL hunk ./CMS.hs 24 -import CMSURL +import URL hunk ./CMS.hs 30 -import Web.Routes +import Web.Routes hiding (nestURL) hunk ./CMSMonad.hs 9 + , nestURL hunk ./CMSMonad.hs 13 +import Admin.URL (AdminURL(..)) hunk ./CMSMonad.hs 19 -import CMSURL (CMSURL(..)) hunk ./CMSMonad.hs 35 -import Web.Routes +import URL (SiteURL(..)) +import Web.Routes hiding (nestURL) +import qualified Web.Routes as R hunk ./CMSMonad.hs 46 -newtype CMS a = CMS { unCMS :: RouteT CMSURL (ServerPartT (StateT CMSState IO)) a } +newtype CMS url a = CMS { unCMS :: RouteT url (ServerPartT (StateT CMSState IO)) a } hunk ./CMSMonad.hs 49 -instance MonadRoute CMS where - type URL CMS = CMSURL - askRouteFn = CMS $ askRouteFn - +nestURL :: (url1 -> url2) -> CMS url1 a -> CMS url2 a +nestURL f (CMS r) = CMS $ R.nestURL f r hunk ./CMSMonad.hs 52 +instance MonadRoute (CMS url) where + type URL (CMS url) = url + askRouteFn = CMS $ askRouteFn hunk ./CMSMonad.hs 56 -query :: forall event. (QueryEvent event, GetAcidState (EventState event)) => event -> CMS (EventResult event) +query :: forall url event. (QueryEvent event, GetAcidState (EventState event)) => event -> CMS url (EventResult event) hunk ./CMSMonad.hs 61 -update :: forall event. (UpdateEvent event, GetAcidState (EventState event)) => event -> CMS (EventResult event) +update :: forall url event. (UpdateEvent event, GetAcidState (EventState event)) => event -> CMS url (EventResult event) hunk ./CMSMonad.hs 66 - - hunk ./CMSMonad.hs 67 -setCurrentPage :: PageId -> CMS () +setCurrentPage :: PageId -> CMS url () hunk ./CMSMonad.hs 71 - hunk ./CMSMonad.hs 73 -instance HSX.XMLGen CMS where - type HSX.XML CMS = XML - newtype HSX.Child CMS = CMSChild { unCMSChild :: XML } - newtype HSX.Attribute CMS = FAttr { unFAttr :: Attribute } +instance HSX.XMLGen (CMS url) where + type HSX.XML (CMS url) = XML + newtype HSX.Child (CMS url) = CMSChild { unCMSChild :: XML } + newtype HSX.Attribute (CMS url) = FAttr { unFAttr :: Attribute } hunk ./CMSMonad.hs 102 -instance IsAttrValue CMS T.Text where +instance IsAttrValue (CMS url) T.Text where hunk ./CMSMonad.hs 105 -instance IsAttrValue CMS TL.Text where +instance IsAttrValue (CMS url) TL.Text where hunk ./CMSMonad.hs 123 -instance HSX.EmbedAsAttr CMS Attribute where +instance HSX.EmbedAsAttr (CMS url) Attribute where hunk ./CMSMonad.hs 126 -instance (IsName n) => HSX.EmbedAsAttr CMS (Attr n String) where +instance (IsName n) => HSX.EmbedAsAttr (CMS url) (Attr n String) where hunk ./CMSMonad.hs 129 -instance (IsName n) => HSX.EmbedAsAttr CMS (Attr n Char) where +instance (IsName n) => HSX.EmbedAsAttr (CMS url) (Attr n Char) where hunk ./CMSMonad.hs 132 -instance (IsName n) => HSX.EmbedAsAttr CMS (Attr n Bool) where +instance (IsName n) => HSX.EmbedAsAttr (CMS url) (Attr n Bool) where hunk ./CMSMonad.hs 136 -instance (IsName n) => HSX.EmbedAsAttr CMS (Attr n Int) where +instance (IsName n) => HSX.EmbedAsAttr (CMS url) (Attr n Int) where hunk ./CMSMonad.hs 139 -instance (IsName n) => HSX.EmbedAsAttr CMS (Attr n Integer) where +instance (IsName n) => HSX.EmbedAsAttr (CMS url) (Attr n Integer) where hunk ./CMSMonad.hs 142 -instance (IsName n) => HSX.EmbedAsAttr CMS (Attr n CMSURL) where +instance (IsName n) => HSX.EmbedAsAttr (CMS SiteURL) (Attr n SiteURL) where hunk ./CMSMonad.hs 146 + +instance (IsName n) => HSX.EmbedAsAttr (CMS AdminURL) (Attr n AdminURL) where + asAttr (n := u) = + do url <- showURL u + asAttr $ MkAttr (toName n, pAttrVal (T.unpack url)) + + hunk ./CMSMonad.hs 160 -instance (IsName n) => (EmbedAsAttr CMS (Attr n TL.Text)) where +instance (IsName n) => (EmbedAsAttr (CMS url) (Attr n TL.Text)) where hunk ./CMSMonad.hs 163 -instance (IsName n) => (EmbedAsAttr CMS (Attr n T.Text)) where +instance (IsName n) => (EmbedAsAttr (CMS url) (Attr n T.Text)) where hunk ./CMSMonad.hs 166 -instance EmbedAsChild CMS Char where +instance EmbedAsChild (CMS url) Char where hunk ./CMSMonad.hs 169 -instance EmbedAsChild CMS String where +instance EmbedAsChild (CMS url) String where hunk ./CMSMonad.hs 172 -instance EmbedAsChild CMS Int where +instance EmbedAsChild (CMS url) Int where hunk ./CMSMonad.hs 175 -instance EmbedAsChild CMS Integer where +instance EmbedAsChild (CMS url) Integer where hunk ./CMSMonad.hs 178 -instance EmbedAsChild CMS Double where +instance EmbedAsChild (CMS url) Double where hunk ./CMSMonad.hs 181 -instance EmbedAsChild CMS Float where +instance EmbedAsChild (CMS url) Float where hunk ./CMSMonad.hs 184 -instance EmbedAsChild CMS TL.Text where +instance EmbedAsChild (CMS url) TL.Text where hunk ./CMSMonad.hs 187 -instance EmbedAsChild CMS T.Text where +instance EmbedAsChild (CMS url) T.Text where hunk ./CMSMonad.hs 190 -instance (EmbedAsChild CMS a) => EmbedAsChild CMS (CMS a) where +instance (EmbedAsChild (CMS url1) a, url1 ~ url2) => EmbedAsChild (CMS url1) (CMS url2 a) where hunk ./CMSMonad.hs 195 -instance (EmbedAsChild CMS a) => EmbedAsChild CMS (IO a) where +instance (EmbedAsChild (CMS url) a) => EmbedAsChild (CMS url) (IO a) where hunk ./CMSMonad.hs 207 -instance EmbedAsChild CMS XML where +instance EmbedAsChild (CMS url) XML where hunk ./CMSMonad.hs 210 -instance EmbedAsChild CMS () where +instance EmbedAsChild (CMS url) () where hunk ./CMSMonad.hs 213 -instance EmbedAsChild CMS UTCTime where +instance EmbedAsChild (CMS url) UTCTime where hunk ./CMSMonad.hs 216 -instance AppendChild CMS XML where +instance AppendChild (CMS url) XML where hunk ./CMSMonad.hs 223 -instance SetAttr CMS XML where +instance SetAttr (CMS url) XML where hunk ./CMSMonad.hs 230 -instance XMLGenerator CMS +instance XMLGenerator (CMS url) hunk ./CMSMonad.hs 237 -instance EmbedAsChild CMS Content where +instance EmbedAsChild (CMS url) Content where hunk ./Main.hs 37 -route :: PluginHandle -> CMSURL -> CMS Response +route :: PluginHandle -> SiteURL -> CMS SiteURL Response hunk ./Main.hs 46 -cms :: PluginHandle -> CMSState -> Site CMSURL (ServerPart Response) +cms :: PluginHandle -> CMSState -> Site SiteURL (ServerPart Response) hunk ./Main.hs 59 -page :: XMLGenT CMS XML -> CMS Response +page :: XMLGenT (CMS url) XML -> CMS url Response hunk ./Page.hs 4 + hunk ./Page.hs 8 -page :: XMLGenT CMS XML +page :: XMLGenT (CMS SiteURL) XML hunk ./Page/API.hs 17 -import CMSURL hunk ./Page/API.hs 22 +import URL hunk ./Page/API.hs 24 -getPage :: CMS Page +getPage :: CMS url Page hunk ./Page/API.hs 32 -getPageTitle :: CMS Text +getPageTitle :: CMS url Text hunk ./Page/API.hs 35 -getPageContent :: CMS Content +getPageContent :: CMS url Content hunk ./Page/API.hs 43 -getPagesSummary :: CMS [(PageId, Text)] +getPagesSummary :: CMS url [(PageId, Text)] hunk ./Page/API.hs 46 -getPageMenu :: GenXML CMS +getPageMenu :: GenXML (CMS SiteURL) hunk ./Page/API.hs 54 - + hunk ./URL.hs 2 -module CMSURL where +module URL where hunk ./URL.hs 11 -data CMSURL +data SiteURL hunk ./URL.hs 16 -$(derivePathInfo ''CMSURL) +$(derivePathInfo ''SiteURL)