Simplify a bit the FilterRegex JSON instance
authorIustin Pop <iustin@google.com>
Mon, 10 Dec 2012 08:46:43 +0000 (09:46 +0100)
committerIustin Pop <iustin@google.com>
Mon, 17 Dec 2012 11:29:53 +0000 (12:29 +0100)
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

htools/Ganeti/Query/Language.hs

index f074439..6987c7d 100644 (file)
@@ -357,9 +357,7 @@ instance Eq FilterRegex where
 -- with the string component.
 instance JSON FilterRegex where
   showJSON (FilterRegex re _) = showJSON re
-  readJSON s = do
-    re <- readJSON s
-    mkRegex re
+  readJSON s = readJSON s >>= mkRegex
 
 -- | Name of a field.
 type FieldName = String