Use TemplateHaskell to build the opID function
authorIustin Pop <iustin@google.com>
Tue, 20 Sep 2011 07:17:53 +0000 (16:17 +0900)
committerIustin Pop <iustin@google.com>
Mon, 3 Oct 2011 09:17:07 +0000 (11:17 +0200)
commit6111e296a8a0e115fe85f3a6b7826164aa2590c8
tree4ab7dd85a3ae272560e1bf022e206bdf2b10df29
parente9aaa3c6c113cabca14860c5da8f83c71f045a96
Use TemplateHaskell to build the opID function

This replaces the hand-coded opID with one automatically generated
from the constructor names, similar to the way Python does it, except
it's done at compilation time as opposed to runtime.

Again, the code line delta does not favour this patch, but this
eliminates error-prone, manual code with auto-generated one; in case
we add more opcode support, this will help a lot.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
htools/Ganeti/OpCodes.hs
htools/Ganeti/THH.hs