happstack-static-routing 0.3.1 → 0.3.2
raw patch · 2 files changed
+20/−15 lines, 2 filesnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Happstack.StaticRouting: class Path m hm a b | a b -> m hm
+ Happstack.StaticRouting: class Path m hm h r | h r -> m
- Happstack.StaticRouting: path :: Path m hm h a => Method -> (m a -> hm b) -> h -> Route (hm b)
+ Happstack.StaticRouting: path :: Path m hm h r => Method -> (m r -> hm r') -> h -> Route (hm r')
Files
happstack-static-routing.cabal view
@@ -1,5 +1,5 @@ Name: happstack-static-routing-Version: 0.3.1+Version: 0.3.2 Synopsis: Support for static URL routing with overlap detection for Happstack. Description: If you have a large routing table in Happstack and want@@ -15,8 +15,8 @@ License: BSD3 License-file: LICENSE Author: Scrive-Maintainer: magnus@scrive.com-Homepage: https://github.com/carlssonia/happstack-static-routing+Maintainer: gracjan@scrive.com+Homepage: https://github.com/scrive/happstack-static-routing Stability: Development Category: Web, Distributed Computing Build-type: Simple@@ -40,4 +40,4 @@ source-repository head type: git- location: git://github.com/carlssonia/happstack-static-routing.git+ location: git://github.com/scrive/happstack-static-routing.git
src/Happstack/StaticRouting/Internal.hs view
@@ -36,17 +36,21 @@ type EndSegment = (Maybe Int, H.Method) -- | Support for varying number of arguments to 'path' handlers.-class Path m hm a b | a b -> m hm where- pathHandler :: (m b -> hm c) -> a -> hm c- arity :: m b -> a -> Int+class Path m hm h r | h r -> m where+ pathHandler :: forall r'. (m r -> hm r') -> h -> hm r'+ arity :: hm r -> h -> Int -instance (FromReqURI d, ServerMonad hm, MonadPlus hm, Path m hm a b)- => Path m hm (d -> a) b where- pathHandler w f = H.path (pathHandler w . f)- arity m f = 1 + arity m (f undefined)+instance (+ FromReqURI v+ , ServerMonad hm+ , MonadPlus hm+ , Path m hm h r+ ) => Path m hm (v -> h) r where+ pathHandler trans f = H.path (pathHandler trans . f)+ arity m f = 1 + arity m (f undefined) -instance Path m hm (m b) b where- pathHandler w m = w m+instance Path m hm (m r) r where+ pathHandler trans mr = trans mr arity _ _ = 0 -- | Pop a path element if it matches the given string.@@ -58,8 +62,9 @@ choice = Choice -- | Expect the given method, and exactly 'n' more segments, where 'n' is the arity of the handler.-path :: forall m hm h a b. Path m hm h a => H.Method -> (m a -> hm b) -> h -> Route (hm b)-path m w h = Handler (Just (arity (undefined::m a) h),m) (pathHandler w h)+path :: forall m hm h r r'. Path m hm h r+ => H.Method -> (m r -> hm r') -> h -> Route (hm r')+path m trans h = Handler (Just (arity (undefined::hm r) h), m) (pathHandler trans h) -- | Expect zero or more segments. remainingPath :: H.Method -> h -> Route h