Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.Bounds
|
||||
where
|
||||
import Control.Lens
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
|
||||
data Bounds = Bounds
|
||||
{ _bdMinX :: Float
|
||||
@@ -10,7 +13,10 @@ data Bounds = Bounds
|
||||
, _bdMinY :: Float
|
||||
, _bdMaxY :: Float
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON Bounds where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Bounds
|
||||
defaultBounds :: Bounds
|
||||
defaultBounds = Bounds 0 0 0 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user