git.iko.soy/typeable/http-api-data
on master help sign in
PathMultiPiece list instance based on PathPiece yesodweb/yesod#932
102e230Michael Snoyman
ChangeLog.md+4
@@ -1,3 +1,7 @@
1+## 0.2.0
2+
3+* Make `PathMultiPiece` instance for lists based on `PathPiece` [Yesod issue #932](https://github.com/yesodweb/yesod/issues/932)
4+
1## 0.1.5
5## 0.1.5
2
6
3Added more integral instances, and check bounds on them [#5](https://github.com/yesodweb/path-pieces/pull/5).
7Added more integral instances, and check bounds on them [#5](https://github.com/yesodweb/path-pieces/pull/5).
Web/PathPieces.hs+3−11
@@ -118,17 +118,9 @@ class PathMultiPiece s where
118 fromPathMultiPiece :: [S.Text] -> Maybe s
118 fromPathMultiPiece :: [S.Text] -> Maybe s
119 toPathMultiPiece :: s -> [S.Text]
119 toPathMultiPiece :: s -> [S.Text]
120
120
121−instance PathMultiPiece [String] where
122− fromPathMultiPiece = Just . map S.unpack
123− toPathMultiPiece = map S.pack
124−
125−instance PathMultiPiece [S.Text] where
121+instance PathPiece a => PathMultiPiece [a] where
126− fromPathMultiPiece = Just
122+ fromPathMultiPiece = mapM fromPathPiece
127− toPathMultiPiece = id
128−
129−instance PathMultiPiece [L.Text] where
130− fromPathMultiPiece = Just . map (L.fromChunks . return)
131− toPathMultiPiece = map $ S.concat . L.toChunks
123+ toPathMultiPiece = map toPathPiece
132
124
133{-# DEPRECATED toSinglePiece "Use toPathPiece instead of toSinglePiece" #-}
125{-# DEPRECATED toSinglePiece "Use toPathPiece instead of toSinglePiece" #-}
134toSinglePiece :: PathPiece p => p -> S.Text
126toSinglePiece :: PathPiece p => p -> S.Text
path-pieces.cabal+1−1
@@ -1,5 +1,5 @@
1name: path-pieces
1name: path-pieces
2−version: 0.1.5
2+version: 0.2.0
3license: BSD3
3license: BSD3
4license-file: LICENSE
4license-file: LICENSE
5author: Michael Snoyman <michael@snoyman.com>
5author: Michael Snoyman <michael@snoyman.com>