saferoute 0.1.1.0 → 0.2.0.0
raw patch · 3 files changed
+9/−32 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Web.Saferoute.Blaze: getUrl :: Resource r => r -> AttributeValue
- Web.Saferoute.Blaze: type ForeignResource = AttributeValue
+ Web.Saferoute: getUrl :: Resource r => r -> AttributeValue
+ Web.Saferoute: type ForeignResource = AttributeValue
- Web.Saferoute: class Eq r => Resource r where resourceList = elems routeResourceMap routeResourceMap = fromList [(route, resource) | resource <- resourceList, let route = getRoute resource] lookupRoute route = lookup route routeResourceMap
+ Web.Saferoute: class Eq r => Resource r where resourceList = elems routeResourceMap routeResourceMap = fromList [(route, resource) | resource <- resourceList, let route = getRoute resource] lookupRoute route = lookup route routeResourceMap getUrl = toValue . getRoute
Files
- saferoute.cabal +3/−10
- src/Web/Saferoute.hs +6/−0
- src/Web/Saferoute/Blaze.hs +0/−22
saferoute.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: saferoute-version: 0.1.1.0+version: 0.2.0.0 synopsis: A simple type-safe routing library. description: saferoute is a type-safe routing library for web applications.@@ -16,26 +16,19 @@ extra-source-files: README.md cabal-version: >=1.10 -flag blaze- description: Support for blaze-html attribute embedding.- default: True- library exposed-modules: Web.Saferoute -- other-modules: other-extensions: build-depends:- base >=4.7 && <4.8+ base >=4.6 && <4.8+ , blaze-html >=0.7 && <0.8 , containers >=0.5 && <0.6 , text >=1.1 && <1.2 hs-source-dirs: src/ default-language: Haskell2010 ghc-options: -Wall-- if flag(blaze)- exposed-modules: Web.Saferoute.Blaze- build-depends: blaze-html >=0.7 && <0.8 source-repository head type: git
src/Web/Saferoute.hs view
@@ -12,10 +12,12 @@ import qualified Data.Map.Lazy as M import qualified Data.Text as S+import qualified Text.Blaze.Html5 as H -- |The type for a route - just an alias for 'S.Text' type Route = S.Text type RoutePart = S.Text+type ForeignResource = H.AttributeValue -- |The type class for a resource. class Eq r => Resource r where@@ -40,4 +42,8 @@ -- isn't associated with any 'Resource', this returns 'Nothing'. lookupRoute :: Route -> Maybe r lookupRoute route = M.lookup route routeResourceMap++ -- |Given a 'Resource', get the URL for it.+ getUrl :: r -> H.AttributeValue+ getUrl = H.toValue . getRoute
− src/Web/Saferoute/Blaze.hs
@@ -1,22 +0,0 @@--- |--- Module : Web.Saferoute.Blaze--- Description : Support for blaze-html--- Copyright : 2014, Peter Harpending.--- License : BSD3--- Maintainer : Peter Harpending <pharpend2@gmail.com>--- Stability : experimental--- Portability : archlinux-----module Web.Saferoute.Blaze where--import qualified Text.Blaze.Html5 as H-import Web.Saferoute---- |Foreign resources need only to have a URL, which needs to be an--- embeddable attribute.-type ForeignResource = H.AttributeValue---- |Given a 'Resource', get the URL for it.-getUrl :: Resource r => r -> H.AttributeValue-getUrl = H.toValue . getRoute