Add some type annotations
This commit is contained in:
parent
e3a95bd92c
commit
7ffff25326
@ -3,6 +3,7 @@
|
|||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||||
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
-- | Field functions allow you to easily create and validate forms, cleanly handling the uncertainty of parsing user input.
|
-- | 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
|
-- @since 1.7.0
|
||||||
optionsPairsGrouped
|
optionsPairsGrouped
|
||||||
:: (MonadHandler m, RenderMessage (HandlerSite m) msg)
|
:: forall m msg a. (MonadHandler m, RenderMessage (HandlerSite m) msg)
|
||||||
=> [(msg, [(msg, a)])] -> m (OptionList a)
|
=> [(msg, [(msg, a)])] -> m (OptionList a)
|
||||||
optionsPairsGrouped opts = do
|
optionsPairsGrouped opts = do
|
||||||
mr <- getMessageRender
|
mr <- getMessageRender
|
||||||
@ -690,14 +691,14 @@ optionsPairsGrouped opts = do
|
|||||||
, optionInternalValue = internal
|
, optionInternalValue = internal
|
||||||
, optionExternalValue = pack $ show external
|
, 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'
|
opts'' = map (\(x, ys) -> (mr x, map mkOption ys)) opts'
|
||||||
return $ mkOptionListGrouped opts''
|
return $ mkOptionListGrouped opts''
|
||||||
|
|
||||||
-- | Helper to enumerate sublists with one consecutive index.
|
-- | 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 =
|
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
|
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
|
in map (\(i, (x, ys)) -> (x, zip [i :: Int ..] ys)) yss
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user