Have add-handler include the function arguments

This commit is contained in:
Maximilian Tagher 2014-12-30 18:49:09 -08:00
parent e96d1c3622
commit 3f20c759dc

View File

@ -107,7 +107,9 @@ mkHandler name pattern methods = unlines
, concat $ func : " :: " : map toArrow types ++ ["Handler Html"] , concat $ func : " :: " : map toArrow types ++ ["Handler Html"]
, concat , concat
[ func [ func
, " = error \"Not yet implemented: " , " "
, concatMap toArgument types
, "= error \"Not yet implemented: "
, func , func
, "\"" , "\""
] ]
@ -118,6 +120,7 @@ mkHandler name pattern methods = unlines
types = getTypes pattern types = getTypes pattern
toArrow t = concat [t, " -> "] toArrow t = concat [t, " -> "]
toArgument t = concat [uncapitalize t, " "]
getTypes "" = [] getTypes "" = []
getTypes ('/':rest) = getTypes rest getTypes ('/':rest) = getTypes rest
@ -126,3 +129,7 @@ mkHandler name pattern methods = unlines
where where
(typ, rest') = break (== '/') rest (typ, rest') = break (== '/') rest
getTypes rest = getTypes $ dropWhile (/= '/') rest getTypes rest = getTypes $ dropWhile (/= '/') rest
uncapitalize :: String -> String
uncapitalize (x:xs) = toLower x : xs
uncapitalize "" = ""