Add generic derivations and To/FromJSON instances
This commit is contained in:
+7
-1
@@ -1,9 +1,15 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
module Color where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Geometry
|
||||
|
||||
data PaletteColor = RED | GREEN | BLUE | YELLOW | CYAN
|
||||
| MAGENTA | ROSE | VIOLET | AZURE | AQUAMARINE | CHARTREUSE | ORANGE | WHITE | BLACK
|
||||
deriving (Eq,Ord,Enum,Show,Read)
|
||||
deriving (Eq,Ord,Enum,Show,Read,Generic)
|
||||
instance ToJSON PaletteColor where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON PaletteColor
|
||||
|
||||
type RGBA = Point4
|
||||
type Color = Point4
|
||||
|
||||
Reference in New Issue
Block a user