Skip to content

Instantly share code, notes, and snippets.

@carlohamalainen
Created July 24, 2013 00:05
Show Gist options
  • Save carlohamalainen/6067156 to your computer and use it in GitHub Desktop.
Save carlohamalainen/6067156 to your computer and use it in GitHub Desktop.
applicative recaptcha
-- Before:
commentForm :: EntryId -> Form Comment
commentForm entryId = renderDivs $ Comment
<$> pure entryId
<*> aformM (liftIO getCurrentTime)
<*> aformM requireAuthId
<*> areq textField (fieldSettingsLabel MsgCommentName) Nothing
<*> areq textareaField (fieldSettingsLabel MsgCommentText) Nothing
-- Adding the ReCAPTCHA form, we just append "<* recaptchaAForm":
commentForm :: EntryId -> Form Comment
commentForm entryId = renderDivs $ Comment
<$> pure entryId
<*> aformM (liftIO getCurrentTime)
<*> aformM requireAuthId
<*> areq textField (fieldSettingsLabel MsgCommentName) Nothing
<*> areq textareaField (fieldSettingsLabel MsgCommentText) Nothing <* recaptchaAForm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment