git.iko.soy/typeable/http-api-data
on master help sign in
Merge pull request #9 from andrewthad/add_pathpiece_instance_for_unit

Add instance for ()

commitbf3348fc70d4b2dfad2deeab2751d8c54f77cfcf authorGreg Weber <greg@gregweber.info> dateThu 27 Aug 2015, 09:42 (11 years ago) parent19b5a76597f2fc
1 file changed+4
Web/PathPieces.hs+4
Web/PathPieces.hs+4
@@ -24,6 +24,10 @@ class PathPiece s where
2424 fromPathPiece :: S.Text -> Maybe s
2525 toPathPiece :: s -> S.Text
2626
27+instance PathPiece () where
28+ fromPathPiece t = if t == "_" then Just () else Nothing
29+ toPathPiece () = "_"
30+
2731instance PathPiece String where
2832 fromPathPiece = Just . S.unpack
2933 toPathPiece = S.pack