diff --git a/yesod-form/Yesod/Form/Fields.hs b/yesod-form/Yesod/Form/Fields.hs index 5f7255d8..7dbaf3c4 100644 --- a/yesod-form/Yesod/Form/Fields.hs +++ b/yesod-form/Yesod/Form/Fields.hs @@ -3,6 +3,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE CPP #-} -- | Field functions allow you to easily create and validate forms, cleanly handling the uncertainty of parsing user input. @@ -681,7 +682,7 @@ optionsPairs opts = do -- -- @since 1.7.0 optionsPairsGrouped - :: (MonadHandler m, RenderMessage (HandlerSite m) msg) + :: forall m msg a. (MonadHandler m, RenderMessage (HandlerSite m) msg) => [(msg, [(msg, a)])] -> m (OptionList a) optionsPairsGrouped opts = do mr <- getMessageRender @@ -690,14 +691,14 @@ optionsPairsGrouped opts = do , optionInternalValue = internal , optionExternalValue = pack $ show external } - opts' = enumerateSublists opts -- :: [(msg, [(Int, (msg, a))])] + opts' = enumerateSublists opts :: [(msg, [(Int, (msg, a))])] opts'' = map (\(x, ys) -> (mr x, map mkOption ys)) opts' return $ mkOptionListGrouped opts'' -- | Helper to enumerate sublists with one consecutive index. -enumerateSublists :: [(a, [b])] -> [(a, [(Int, b)])] +enumerateSublists :: forall a b. [(a, [b])] -> [(a, [(Int, b)])] enumerateSublists xss = - let -- yss :: [(Int, (a, [b]))] + let yss :: [(Int, (a, [b]))] yss = snd $ foldl (\(i, res) xs -> (i + (length.snd) xs, res ++ [(i, xs)])) (1, []) xss in map (\(i, (x, ys)) -> (x, zip [i :: Int ..] ys)) yss