Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added router for Integers

  • Loading branch information...
commit 918976f8618504879f94b6f331e27402767efc3b 1 parent d159d89
@MedeaMelana authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 Web/Zwaluw.hs
View
8 Web/Zwaluw.hs
@@ -19,7 +19,7 @@ module Web.Zwaluw (
, manyl, somel, chainl, chainl1
-- * Built-in routers
- , int, string, char, digit, hexDigit
+ , int, integer, string, char, digit, hexDigit
, (/), part
, rNil, rCons, rList, rListSep
@@ -100,10 +100,14 @@ push a = pure (a :-) (\(a' :- t) -> guard (a' == a) >> Just t)
readshow :: (Show a, Read a) => Router r (a :- r)
readshow = val reads (return . shows)
--- | Routes any integer.
+-- | Routes any @Int@.
int :: Router r (Int :- r)
int = readshow
+-- | Routes any @Integer@.
+integer :: Router r (Integer :- r)
+integer = readshow
+
-- | Routes any string.
string :: Router r (String :- r)
string = val (\s -> [(s, "")]) (return . (++))
Please sign in to comment.
Something went wrong with that request. Please try again.