5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maedermodule Persistence.Schema.EvaluationStateType where
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maederimport Data.List (isPrefixOf)
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maederimport Database.Persist.TH
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maederdata EvaluationStateType = NotYetEnqueued
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | Enqueued
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | Processing
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | FinishedSuccessfully
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | FinishedUnsuccessfully
75067b1beba1380cde707c30e7fc050d86f6927fKarl Luc deriving (Eq)
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maederinstance Show EvaluationStateType where
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder show NotYetEnqueued = "not_yet_enqueued"
75067b1beba1380cde707c30e7fc050d86f6927fKarl Luc show Enqueued = "enqueued"
7b1111ca3b126f71cce47e60ce4b56e6f92422e9Karl Luc show Processing = "processing"
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder show FinishedSuccessfully = "finished_successfully"
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder show FinishedUnsuccessfully = "finished_unsuccessfully"
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maederinstance Read EvaluationStateType where
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder readsPrec _ input
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | show NotYetEnqueued `isPrefixOf` input = [(NotYetEnqueued, drop (length $ show NotYetEnqueued) input)]
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | show Enqueued `isPrefixOf` input = [(Enqueued, drop (length $ show Enqueued) input)]
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | show Processing `isPrefixOf` input = [(Processing, drop (length $ show Processing) input)]
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | show FinishedSuccessfully `isPrefixOf` input = [(FinishedSuccessfully, drop (length $ show FinishedSuccessfully) input)]
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | show FinishedUnsuccessfully `isPrefixOf` input = [(FinishedUnsuccessfully, drop (length $ show FinishedUnsuccessfully) input)]
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder | otherwise = []
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian MaederderivePersistField "EvaluationStateType"
5096f518ac5380a0834a09b22a8b38fabe247bf5Christian Maeder