Advertisement
Guest User

Untitled

a guest
Feb 10th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. readPaypal :: String -> IO (Vector PaypalEntry)
  2. readPaypal path = do
  3.     readBS <- Data.ByteString.Lazy.readFile path
  4.     let eitherVector = decode HasHeader readBS
  5.     return $ case eitherVector of
  6.         Left errMsg -> error errMsg
  7.         Right vec -> vec
  8.  
  9.  
  10.  
  11.  
  12.  
  13. data PaypalEntry = PaypalEntry
  14.     { peDate      :: Text
  15.     , peTime      :: Text
  16.     , peTimeZone  :: Text
  17.     , peName      :: Text
  18.     , peType      :: Text
  19.     , peStatus    :: Text
  20.     , peCurrency  :: Text
  21.     , peAmount    :: Text
  22.     , peReceiptID :: Text
  23.     , peBalance   :: Text
  24.     } deriving (Generic, Show)
  25.  
  26. instance FromRecord PaypalEntry
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement