On Wed, Aug 13, 2014 at 10:14:29AM +0200, 'Aaron Karper' via ganeti-devel wrote:
> Signed-off-by: Aaron Karper <[email protected]>
> ---
>  src/Ganeti/DataCollectors/Types.hs | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/Ganeti/DataCollectors/Types.hs 
> b/src/Ganeti/DataCollectors/Types.hs
> index e43dfd6..7d6ab53 100644
> --- a/src/Ganeti/DataCollectors/Types.hs
> +++ b/src/Ganeti/DataCollectors/Types.hs
> @@ -52,7 +52,7 @@ import Ganeti.Utils (getCurrentTime)
> 
>  -- | The possible classes a data collector can belong to.
>  data DCCategory = DCInstance | DCStorage | DCDaemon | DCHypervisor
> -  deriving (Show, Eq, Read)
> +  deriving (Show, Eq, Read, Enum)

Why not also derive Bounded and...

>  -- | Get the category name and return it as a string.
>  getCategoryName :: DCCategory -> String
> @@ -60,7 +60,7 @@ getCategoryName dcc = map toLower . drop 2 . show $ dcc
> 
>  categoryNames :: Map.Map String DCCategory
>  categoryNames =
> -  let l = [DCInstance, DCStorage, DCDaemon, DCHypervisor]
> +  let l = [DCInstance ..]
>    in Map.fromList $ zip (map getCategoryName l) l

...use [minBound ..] here?

-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to