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