module BishBosh.Attribute.PhysicalColour(
PhysicalColour(),
black,
red,
green,
yellow,
blue,
magenta,
cyan,
white
) where
import qualified BishBosh.Property.FixedMembership as Property.FixedMembership
import qualified BishBosh.Property.Opposable as Property.Opposable
import qualified Control.DeepSeq
import qualified Text.XML.HXT.Arrow.Pickle as HXT
import qualified Text.XML.HXT.Arrow.Pickle.Schema
data PhysicalColour
= Black
| Red
| Green
| Yellow
| Blue
| Magenta
| Cyan
| White
deriving (Int -> PhysicalColour
PhysicalColour -> Int
PhysicalColour -> [PhysicalColour]
PhysicalColour -> PhysicalColour
PhysicalColour -> PhysicalColour -> [PhysicalColour]
PhysicalColour
-> PhysicalColour -> PhysicalColour -> [PhysicalColour]
(PhysicalColour -> PhysicalColour)
-> (PhysicalColour -> PhysicalColour)
-> (Int -> PhysicalColour)
-> (PhysicalColour -> Int)
-> (PhysicalColour -> [PhysicalColour])
-> (PhysicalColour -> PhysicalColour -> [PhysicalColour])
-> (PhysicalColour -> PhysicalColour -> [PhysicalColour])
-> (PhysicalColour
-> PhysicalColour -> PhysicalColour -> [PhysicalColour])
-> Enum PhysicalColour
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: PhysicalColour
-> PhysicalColour -> PhysicalColour -> [PhysicalColour]
$cenumFromThenTo :: PhysicalColour
-> PhysicalColour -> PhysicalColour -> [PhysicalColour]
enumFromTo :: PhysicalColour -> PhysicalColour -> [PhysicalColour]
$cenumFromTo :: PhysicalColour -> PhysicalColour -> [PhysicalColour]
enumFromThen :: PhysicalColour -> PhysicalColour -> [PhysicalColour]
$cenumFromThen :: PhysicalColour -> PhysicalColour -> [PhysicalColour]
enumFrom :: PhysicalColour -> [PhysicalColour]
$cenumFrom :: PhysicalColour -> [PhysicalColour]
fromEnum :: PhysicalColour -> Int
$cfromEnum :: PhysicalColour -> Int
toEnum :: Int -> PhysicalColour
$ctoEnum :: Int -> PhysicalColour
pred :: PhysicalColour -> PhysicalColour
$cpred :: PhysicalColour -> PhysicalColour
succ :: PhysicalColour -> PhysicalColour
$csucc :: PhysicalColour -> PhysicalColour
Enum, PhysicalColour -> PhysicalColour -> Bool
(PhysicalColour -> PhysicalColour -> Bool)
-> (PhysicalColour -> PhysicalColour -> Bool) -> Eq PhysicalColour
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalColour -> PhysicalColour -> Bool
$c/= :: PhysicalColour -> PhysicalColour -> Bool
== :: PhysicalColour -> PhysicalColour -> Bool
$c== :: PhysicalColour -> PhysicalColour -> Bool
Eq, ReadPrec [PhysicalColour]
ReadPrec PhysicalColour
Int -> ReadS PhysicalColour
ReadS [PhysicalColour]
(Int -> ReadS PhysicalColour)
-> ReadS [PhysicalColour]
-> ReadPrec PhysicalColour
-> ReadPrec [PhysicalColour]
-> Read PhysicalColour
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhysicalColour]
$creadListPrec :: ReadPrec [PhysicalColour]
readPrec :: ReadPrec PhysicalColour
$creadPrec :: ReadPrec PhysicalColour
readList :: ReadS [PhysicalColour]
$creadList :: ReadS [PhysicalColour]
readsPrec :: Int -> ReadS PhysicalColour
$creadsPrec :: Int -> ReadS PhysicalColour
Read, Int -> PhysicalColour -> ShowS
[PhysicalColour] -> ShowS
PhysicalColour -> String
(Int -> PhysicalColour -> ShowS)
-> (PhysicalColour -> String)
-> ([PhysicalColour] -> ShowS)
-> Show PhysicalColour
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhysicalColour] -> ShowS
$cshowList :: [PhysicalColour] -> ShowS
show :: PhysicalColour -> String
$cshow :: PhysicalColour -> String
showsPrec :: Int -> PhysicalColour -> ShowS
$cshowsPrec :: Int -> PhysicalColour -> ShowS
Show)
instance Control.DeepSeq.NFData PhysicalColour where
rnf :: PhysicalColour -> ()
rnf PhysicalColour
_ = ()
instance Bounded PhysicalColour where
minBound :: PhysicalColour
minBound = PhysicalColour
black
maxBound :: PhysicalColour
maxBound = PhysicalColour
white
instance HXT.XmlPickler PhysicalColour where
xpickle :: PU PhysicalColour
xpickle = (String -> PhysicalColour, PhysicalColour -> String)
-> PU String -> PU PhysicalColour
forall a b. (a -> b, b -> a) -> PU a -> PU b
HXT.xpWrap (String -> PhysicalColour
forall a. Read a => String -> a
read, PhysicalColour -> String
forall a. Show a => a -> String
show) (PU String -> PU PhysicalColour)
-> ([String] -> PU String) -> [String] -> PU PhysicalColour
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Schema -> PU String
HXT.xpTextDT (Schema -> PU String)
-> ([String] -> Schema) -> [String] -> PU String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> Schema
Text.XML.HXT.Arrow.Pickle.Schema.scEnum ([String] -> PU PhysicalColour) -> [String] -> PU PhysicalColour
forall a b. (a -> b) -> a -> b
$ (PhysicalColour -> String) -> [PhysicalColour] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map PhysicalColour -> String
forall a. Show a => a -> String
show [PhysicalColour]
range
instance Property.Opposable.Opposable PhysicalColour where
getOpposite :: PhysicalColour -> PhysicalColour
getOpposite PhysicalColour
physicalColour = Int -> PhysicalColour
forall a. Enum a => Int -> a
toEnum (Int -> PhysicalColour) -> Int -> PhysicalColour
forall a b. (a -> b) -> a -> b
$ PhysicalColour -> Int
forall a. Enum a => a -> Int
fromEnum (PhysicalColour
forall a. Bounded a => a
maxBound :: PhysicalColour) Int -> Int -> Int
forall a. Num a => a -> a -> a
- PhysicalColour -> Int
forall a. Enum a => a -> Int
fromEnum PhysicalColour
physicalColour
range :: [PhysicalColour]
range :: [PhysicalColour]
range = [PhysicalColour
forall a. Bounded a => a
minBound .. PhysicalColour
forall a. Bounded a => a
maxBound]
instance Property.FixedMembership.FixedMembership PhysicalColour where
members :: [PhysicalColour]
members = [PhysicalColour]
range
black :: PhysicalColour
black :: PhysicalColour
black = PhysicalColour
Black
red :: PhysicalColour
red :: PhysicalColour
red = PhysicalColour
Red
green :: PhysicalColour
green :: PhysicalColour
green = PhysicalColour
Green
yellow :: PhysicalColour
yellow :: PhysicalColour
yellow = PhysicalColour
Yellow
blue :: PhysicalColour
blue :: PhysicalColour
blue = PhysicalColour
Blue
magenta :: PhysicalColour
magenta :: PhysicalColour
magenta = PhysicalColour
Magenta
cyan :: PhysicalColour
cyan :: PhysicalColour
cyan = PhysicalColour
Cyan
white :: PhysicalColour
white :: PhysicalColour
white = PhysicalColour
White