From c0a70a62513baf2b437db4ebe3e5a32e3cfa5905 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 23 Feb 2021 21:48:55 +0100 Subject: init --- src/Graphics/X11/Xlib/Aeson.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/Graphics/X11/Xlib/Aeson.hs (limited to 'src/Graphics/X11') diff --git a/src/Graphics/X11/Xlib/Aeson.hs b/src/Graphics/X11/Xlib/Aeson.hs new file mode 100644 index 0000000..62887ac --- /dev/null +++ b/src/Graphics/X11/Xlib/Aeson.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} +module Graphics.X11.Xlib.Aeson () where + +import Data.Aeson +import Graphics.X11.Xlib.Types + + +instance ToJSON Rectangle where + toJSON Rectangle{..} = + object + [ "x" .= toJSON rect_x + , "y" .= toJSON rect_y + , "width" .= toJSON rect_width + , "height" .= toJSON rect_height + ] + +instance FromJSON Rectangle where + parseJSON = withObject "Rectangle" $ \v -> Rectangle + <$> v .: "x" + <*> v .: "y" + <*> v .: "width" + <*> v .: "height" -- cgit v1.2.3