Add generic derivations and To/FromJSON instances

This commit is contained in:
2022-07-25 22:49:18 +01:00
parent f5604ef429
commit b8e8413daa
99 changed files with 1406 additions and 517 deletions
+7 -1
View File
@@ -1,10 +1,16 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE DeriveGeneric #-}
module MaybeHelp where
import Control.Lens
import Data.Aeson
import GHC.Generics
data Maybe' a = Just' {__Just' :: a} | Nothing'
deriving (Eq,Ord,Show,Read)
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON a => ToJSON (Maybe' a) where
toEncoding = genericToEncoding defaultOptions
instance FromJSON a => FromJSON (Maybe' a)
fromJust' :: Maybe' a -> a
fromJust' mx = case mx of