web-routes-quasi 0.6.3 → 0.6.3.1
raw patch · 3 files changed
+7/−4 lines, 3 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Web.Routes.Quasi.TH: instance Show Pieces
Files
- Web/Routes/Quasi/Classes.hs +3/−3
- Web/Routes/Quasi/TH.hs +3/−0
- web-routes-quasi.cabal +1/−1
Web/Routes/Quasi/Classes.hs view
@@ -14,13 +14,13 @@ fromSinglePiece :: String -> Either String s toSinglePiece :: s -> String instance SinglePiece String where- fromSinglePiece = Right+ fromSinglePiece s = if null s then Left "Empty string" else Right s toSinglePiece = id instance SinglePiece S.Text where- fromSinglePiece = Right . S.pack+ fromSinglePiece s = if null s then Left "Empty string" else Right (S.pack s) toSinglePiece = S.unpack instance SinglePiece L.Text where- fromSinglePiece = Right . L.pack+ fromSinglePiece s = if null s then Left "Empty string" else Right (L.pack s) toSinglePiece = L.unpack instance SinglePiece Integer where fromSinglePiece s = case reads s of
Web/Routes/Quasi/TH.hs view
@@ -26,6 +26,7 @@ , ssPieces :: [Piece] } | Simple [Piece] [String] -- ^ methods+ deriving Show type THResource = (String, Pieces) createRoutes :: [THResource] -> Q [Con]@@ -116,6 +117,7 @@ return $ Clause [pat] (NormalB $ cons bod r') [] go' (_, StaticPiece _) = Nothing go' (i, _) = Just $ VarP $ mkName $ "var" ++ show (i :: Int)+ mkBod :: (Show t) => [(t, Piece)] -> Q Exp mkBod [] = lift ([] :: [String]) mkBod ((_, StaticPiece x):xs) = do x' <- lift x@@ -169,6 +171,7 @@ -> Q [Clause] createDispatch modMaster toMaster = mapM go where+ go :: (String, Pieces) -> Q Clause go (n, Simple ps methods) = do meth <- newName "method" xs <- mapM newName $ replicate (length $ filter notStatic ps) "x"
web-routes-quasi.cabal view
@@ -1,5 +1,5 @@ name: web-routes-quasi-version: 0.6.3+version: 0.6.3.1 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>