From e3a95bd92cc932fe9d4258c94a290402a6ef681b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Sch=C3=B6ttl?= Date: Wed, 14 Apr 2021 09:40:21 +0200 Subject: [PATCH] Simplify code, fix linter warnings --- yesod-form/README.md | 2 +- yesod-form/Yesod/Form/Fields.hs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/yesod-form/README.md b/yesod-form/README.md index 097995c4..29bd5767 100644 --- a/yesod-form/README.md +++ b/yesod-form/README.md @@ -3,7 +3,7 @@ Form handling for Yesod, in the same style as formlets. See [the forms chapter](http://www.yesodweb.com/book/forms) of the Yesod book. -This package provies a set of basic form inputs such as text, number, time, +This package provides a set of basic form inputs such as text, number, time, checkbox, select, textarea, and etc. via `Yesod.Form.Fields` module. Also, there is `Yesod.Form.Nic` module providing richtext field using Nic editor. However, this module is grandfathered now and Nic editor is not actively diff --git a/yesod-form/Yesod/Form/Fields.hs b/yesod-form/Yesod/Form/Fields.hs index f242131b..5f7255d8 100644 --- a/yesod-form/Yesod/Form/Fields.hs +++ b/yesod-form/Yesod/Form/Fields.hs @@ -813,11 +813,11 @@ selectFieldHelper outside onOpt inside grpHdr opts' = Field , fieldView = \theId name attrs val isReq -> do outside theId name attrs $ do optsFlat <- fmap (olOptions.flattenOptionList) $ handlerToWidget opts' - unless isReq $ onOpt theId name $ not $ render optsFlat val `elem` map optionExternalValue optsFlat + unless isReq $ onOpt theId name $ render optsFlat val `notElem` map optionExternalValue optsFlat opts'' <- handlerToWidget opts' case opts'' of - (OptionList{}) -> constructOptions theId name attrs val isReq optsFlat - (OptionListGrouped{olOptionsGrouped=grps}) -> do + OptionList{} -> constructOptions theId name attrs val isReq optsFlat + OptionListGrouped{olOptionsGrouped=grps} -> do forM_ grps $ \(grp, opts) -> do case grpHdr of Just hdr -> hdr grp @@ -841,7 +841,7 @@ selectFieldHelper outside onOpt inside grpHdr opts' = Field name ((if isReq then (("required", "required"):) else id) attrs) (optionExternalValue opt) - ((render opts val) == optionExternalValue opt) + (render opts val == optionExternalValue opt) (optionDisplay opt) -- | Creates an input with @type="file"@. @@ -939,7 +939,7 @@ prependZero t0 = if T.null t1 then "-0." `T.append` (T.drop 2 t1) else t1 - where t1 = T.dropWhile ((==) ' ') t0 + where t1 = T.dropWhile (==' ') t0 -- $optionsOverview -- These functions create inputs where one or more options can be selected from a list.