yesod-form 1.4.5 → 1.4.6
raw patch · 3 files changed
+16/−1 lines, 3 files
Files
- ChangeLog.md +4/−0
- Yesod/Form/Fields.hs +11/−0
- yesod-form.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.4.6++* Functor instances for Option/OptionList+ ## 1.4.5 * Foldable/Traversable instances for FormResult [#1089](https://github.com/yesodweb/yesod/pull/1089)
Yesod/Form/Fields.hs view
@@ -591,6 +591,12 @@ { olOptions :: [Option a] , olReadExternal :: Text -> Maybe a -- ^ A function mapping from the form's value ('optionExternalValue') to the selected Haskell value ('optionInternalValue'). }++-- | Since 1.4.6+instance Functor OptionList where+ fmap f (OptionList options readExternal) = + OptionList ((fmap.fmap) f options) (fmap f . readExternal)+ -- | Creates an 'OptionList', using a 'Map' to implement the 'olReadExternal' function. mkOptionList :: [Option a] -> OptionList a mkOptionList os = OptionList@@ -603,6 +609,11 @@ , optionInternalValue :: a -- ^ The Haskell value being selected. , optionExternalValue :: Text -- ^ The representation of this value stored in the form. }++-- | Since 1.4.6+instance Functor Option where+ fmap f (Option display internal external) = Option display (f internal) external+ -- | Creates an 'OptionList' from a list of (display-value, internal value) pairs. optionsPairs :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => [(msg, a)] -> m (OptionList a)
yesod-form.cabal view
@@ -1,5 +1,5 @@ name: yesod-form-version: 1.4.5+version: 1.4.6 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>