git.iko.soy/typeable/octopod
on new-control-scripts help sign in
47 lines 1.5 kB history raw
1{-# OPTIONS_GHC -fno-warn-orphans #-}
3module Orphans () where
5import Common.Types
6import Data.Maybe
7import Rel8
9parseTypeInformationFromMapping :: (Eq a, Eq b, DBType b, Show b, Show a) => [(a, b)] -> TypeInformation a
10parseTypeInformationFromMapping m =
11 parseTypeInformation
12 (\v -> maybe (Left $ "unknown value: " <> show v) Right . flip lookup reversedM $ v)
13 (\v -> fromMaybe (error $ "forgot case: " <> show v) . flip lookup m $ v)
14 typeInformation
15 where
16 reversedM = (\(x, y) -> (y, x)) <$> m
18deriving via JSONBEncoded (Overrides l) instance (DBType (Overrides l))
20deriving newtype instance DBType DeploymentId
21deriving newtype instance DBEq DeploymentId
23deriving newtype instance DBType DeploymentName
24deriving newtype instance DBEq DeploymentName
26instance DBType Action where
27 typeInformation = parseTypeInformationFromMapping actionText
29deriving newtype instance DBType ArchivedFlag
31deriving newtype instance DBType Duration
33deriving newtype instance DBType Timestamp
35deriving newtype instance DBType ProjectName
37deriving anyclass instance DBEq DeploymentStatus
38instance DBType DeploymentStatus where
39 typeInformation = parseTypeInformationFromMapping deploymentStatusText
41deriving via JSONBEncoded DeploymentMetadata instance DBType DeploymentMetadata
43deriving newtype instance DBType Stdout
44deriving newtype instance DBType Stderr
46deriving newtype instance DBType ActionId
47deriving newtype instance DBEq ActionId