Revision 139c0683 htools/Ganeti/Query/Language.hs

b/htools/Ganeti/Query/Language.hs
120 120
-- | Overall query type.
121 121
data ItemType = ItemTypeLuxi QueryTypeLuxi
122 122
              | ItemTypeOpCode QueryTypeOp
123
                deriving (Show, Read, Eq)
123
                deriving (Show, Eq)
124 124

  
125 125
-- | Custom JSON decoder for 'ItemType'.
126 126
decodeItemType :: (Monad m) => JSValue -> m ItemType
......
172 172
    | GEFilter       a FilterValue  -- ^ @>=@ /field/ /value/
173 173
    | RegexpFilter   a FilterRegex  -- ^ @=~@ /field/ /regexp/
174 174
    | ContainsFilter a FilterValue  -- ^ @=[]@ /list-field/ /value/
175
      deriving (Show, Read, Eq)
175
      deriving (Show, Eq)
176 176

  
177 177
-- | Serialiser for the 'Filter' data type.
178 178
showFilter :: (JSON a) => Filter a -> JSValue
......
293 293
-- | Value to compare the field value to, for filtering purposes.
294 294
data FilterValue = QuotedString String
295 295
                 | NumericValue Integer
296
                   deriving (Read, Show, Eq)
296
                   deriving (Show, Eq)
297 297

  
298 298
-- | Serialiser for 'FilterValue'. The Python code just sends this to
299 299
-- JSON as-is, so we'll do the same.
......
348 348
instance Show FilterRegex where
349 349
  show (FilterRegex re _) = "mkRegex " ++ show re
350 350

  
351
-- | 'Read' instance: we manually read \"mkRegex\" followed by a
352
-- string, and build the 'FilterRegex' using that.
353
instance Read FilterRegex where
354
  readsPrec _ str = do
355
    ("mkRegex", s') <- lex str
356
    (re, s'') <- reads s'
357
    filterre <- mkRegex re
358
    return (filterre, s'')
359

  
360 351
-- | 'Eq' instance: we only compare the string versions of the regexes.
361 352
instance Eq FilterRegex where
362 353
  (FilterRegex re1 _) == (FilterRegex re2 _) = re1 == re2
......
388 379
data ResultEntry = ResultEntry
389 380
  { rentryStatus :: ResultStatus      -- ^ The result status
390 381
  , rentryValue  :: Maybe ResultValue -- ^ The (optional) result value
391
  } deriving (Show, Read, Eq)
382
  } deriving (Show, Eq)
392 383

  
393 384
instance JSON ResultEntry where
394 385
  showJSON (ResultEntry rs rv) =

Also available in: Unified diff