git.iko.soy/typeable/http-api-data
on master help sign in
The instance for Maybe can now parse the string "Nothing".
54247f9MomemtumMori
Web/PathPieces.hs+6−3
@@ -83,9 +83,12 @@ instance PathMultiPiece [L.Text] where
83 toPathMultiPiece = map $ S.concat . L.toChunks
83 toPathMultiPiece = map $ S.concat . L.toChunks
84
84
85instance (PathPiece a) => PathPiece (Maybe a) where
85instance (PathPiece a) => PathPiece (Maybe a) where
86− fromPathPiece s = case s of
86+ fromPathPiece s = if isPrefixOf "Just " s
87− "Nothing" -> Just Nothing
88− _ -> Just $ fromPathPiece s
87+ then Just $ fromPathPiece $ fromJust $ stripPrefix "Just " s
88+ else
89+ if s == "Nothing"
90+ then Just Nothing
91+ else Nothing
89 toPathPiece m = case m of
92 toPathPiece m = case m of
90 Just s -> toPathPiece s
93 Just s -> toPathPiece s
91 _ -> "Nothing"
94 _ -> "Nothing"