mateamt/src/Types/Purchase.hs

31 lines
528 B
Haskell
Raw Normal View History

2019-07-18 17:01:49 +00:00
{-# LANGUAGE DeriveGeneric #-}
module Types.Purchase where
import Data.Text
import GHC.Generics
data PurchaseDetail = PurchaseDetail
{ pdBeverage :: Int
, pdAmount :: Int
}
instance ToJSON PurchaseDetail where
toEncoding = genericToEncoding defaultOptions
instance fromJSON PurchaseDetail
data PurchaseResult
= PurchaseOK
| PurchaseDebtful
| PayAmount Int
deriving (Generic, Show)
instance ToJSON PurchaseResult where
toEncoding = genericToEncoding defaultOptions
instance fromJSON PurchaseResult