Permalink
Browse files

Added printAs.

  • Loading branch information...
1 parent 2b43ab7 commit aac5a430a5310f09f4098ab15bdaa0e5ff285804 @sjoerdvisscher sjoerdvisscher committed Nov 12, 2010
Showing with 7 additions and 0 deletions.
  1. +7 −0 Web/Zwaluw.hs
View
@@ -166,6 +166,13 @@ duck r = Router
(\(h :- t) -> map (first (h :-)) $ ser r t)
(map (first (\f (h :- t) -> h :- f t)) . prs r)
+printAs :: Router a b -> String -> Router a b
+printAs r s = Router
+ (\b -> case ser r b of
+ [] -> []
+ (a, _) : _ -> [(a, s)])
+ (prs r)
+
nilP :: Router r ([a] :- r)
nilP = constr0 [] $ \x -> do [] <- x; Just ()

0 comments on commit aac5a43

Please sign in to comment.