diff --git a/Web/Routes/PathInfo.hs b/Web/Routes/PathInfo.hs old mode 100644 new mode 100755 index 2df2967..d22d027 --- a/Web/Routes/PathInfo.hs +++ b/Web/Routes/PathInfo.hs @@ -308,18 +308,10 @@ instance PathInfo Text where toPathSegments = (:[]) fromPathSegments = anySegment -instance PathInfo [Text] where - toPathSegments = id - fromPathSegments = many anySegment - instance PathInfo String where toPathSegments = (:[]) . pack fromPathSegments = unpack <$> anySegment -instance PathInfo [String] where - toPathSegments = id . map pack - fromPathSegments = many (unpack <$> anySegment) - instance PathInfo Int where toPathSegments i = [pack $ show i] fromPathSegments = pToken (const "Int") checkInt @@ -340,3 +332,7 @@ instance PathInfo Integer where | Text.null r -> Just n | otherwise -> Nothing + +instance PathInfo a => PathInfo [a] where + toPathSegments = concat . fmap toPathSegments + fromPathSegments = many fromPathSegments