git.iko.soy/typeable/http-api-data
on master help sign in
Added instance for Maybe.
1aa1d78MomemtumMori
Web/PathPieces.hs+8
@@ -82,6 +82,14 @@ instance PathMultiPiece [L.Text] where
82 fromPathMultiPiece = Just . map (L.fromChunks . return)
82 fromPathMultiPiece = Just . map (L.fromChunks . return)
83 toPathMultiPiece = map $ S.concat . L.toChunks
83 toPathMultiPiece = map $ S.concat . L.toChunks
84
84
85+instance (PathPiece a) => PathPiece (Maybe a) where
86+ fromPathPiece s = case s of
87+ "Nothing" -> Just Nothing
88+ _ -> Just $ fromPathPiece s
89+ toPathPiece m = case m of
90+ Just s -> toPathPiece s
91+ _ -> "Nothing"
92+
85{-# DEPRECATED toSinglePiece "Use toPathPiece instead of toSinglePiece" #-}
93{-# DEPRECATED toSinglePiece "Use toPathPiece instead of toSinglePiece" #-}
86toSinglePiece :: PathPiece p => p -> S.Text
94toSinglePiece :: PathPiece p => p -> S.Text
87toSinglePiece = toPathPiece
95toSinglePiece = toPathPiece