Implement reverse mapping of values to names
authorIustin Pop <iustin@google.com>
Fri, 4 May 2012 06:39:40 +0000 (23:39 -0700)
committerIustin Pop <iustin@google.com>
Mon, 7 May 2012 08:19:59 +0000 (10:19 +0200)
commit79a04823186b5f1020a49a099f7dfebe6d5ef035
treea4aa444d7dfdb564c14dcbe1c287f27fae958116
parent09dc9a027f1fec89cd94dc324a5bdf3f3c5215f8
Implement reverse mapping of values to names

This adds a bit of dumb mapping of values to names, while trying to be
safe. This is the best we can do without resorting to parsing or
interpreting ASTs.

The difference in the output is:

 -- | Converted from Python list or set ADMINST_ALL
 adminstAll :: [String]
-adminstAll = ["down", "offline", "up"]
+adminstAll = [adminstDown, adminstOffline, adminstUp]

Since for most such values we use strings, we don't gain in type
safety on the Haskell side. But it makes the output more readable and
it might open up other opportunities later.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
autotools/convert-constants