LGTM, thanks.

On Tue, Jan 21, 2014 at 4:00 PM, Klaus Aehlig <[email protected]> wrote:

> As the same construction is used in several places, it is better
> to have it factored out as a named function.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/Query/Types.hs | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/Ganeti/Query/Types.hs b/src/Ganeti/Query/Types.hs
> index 7f21449..476cbbd 100644
> --- a/src/Ganeti/Query/Types.hs
> +++ b/src/Ganeti/Query/Types.hs
> @@ -33,6 +33,7 @@ module Ganeti.Query.Types
>    , FieldList
>    , FieldMap
>    , isRuntimeField
> +  , fieldListToFieldMap
>    ) where
>
>  import qualified Data.Map as Map
> @@ -75,3 +76,7 @@ isRuntimeField :: FieldGetter a b -> Bool
>  isRuntimeField FieldRuntime {}       = True
>  isRuntimeField FieldConfigRuntime {} = True
>  isRuntimeField _                     = False
> +
> +-- | Helper function to obtain a FieldMap from the corresponding
> FieldList.
> +fieldListToFieldMap :: FieldList a b -> FieldMap a b
> +fieldListToFieldMap = Map.fromList . map (\v@(f, _, _) -> (fdefName f,
> v))
> --
> 1.8.5.3
>
>

Reply via email to