git.iko.soy/typeable/http-api-data
on master help sign in
No null checking (yesodweb/yesod#421)
658f725Michael Snoyman
Web/PathPieces.hs+3−3
@@ -20,15 +20,15 @@ class PathPiece s where
20 toPathPiece :: s -> S.Text
20 toPathPiece :: s -> S.Text
21
21
22instance PathPiece String where
22instance PathPiece String where
23− fromPathPiece s = if S.null s then Nothing else Just (S.unpack s)
23+ fromPathPiece = Just . S.unpack
24 toPathPiece = S.pack
24 toPathPiece = S.pack
25
25
26instance PathPiece S.Text where
26instance PathPiece S.Text where
27− fromPathPiece s = if S.null s then Nothing else Just s
27+ fromPathPiece = Just
28 toPathPiece = id
28 toPathPiece = id
29
29
30instance PathPiece L.Text where
30instance PathPiece L.Text where
31− fromPathPiece s = if S.null s then Nothing else Just (L.fromChunks [s])
31+ fromPathPiece = Just . L.fromChunks . return
32 toPathPiece = S.concat . L.toChunks
32 toPathPiece = S.concat . L.toChunks
33
33
34instance PathPiece Integer where
34instance PathPiece Integer where
path-pieces.cabal+1−1
@@ -1,5 +1,5 @@
1name: path-pieces
1name: path-pieces
2−version: 0.1.1
2+version: 0.1.2
3license: BSD3
3license: BSD3
4license-file: LICENSE
4license-file: LICENSE
5author: Michael Snoyman <michael@snoyman.com>
5author: Michael Snoyman <michael@snoyman.com>