Guest User

Untitled

a guest
Apr 16th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. customOptions :: Options
  2. customOptions = defaultOptions
  3. { fieldLabelModifier = tail
  4. , constructorTagModifier = map toLower
  5. , unwrapUnaryRecords = True
  6. }
  7.  
  8. data Auth = Auth
  9. { _username :: String
  10. , _password :: String
  11. } deriving (Generic, Show)
  12.  
  13. instance ToJSON Auth where
  14. toEncoding = genericToEncoding customOptions
  15. instance FromJSON Auth where
  16. parseJSON = genericParseJSON customOptions
  17.  
  18.  
  19. -- res <- post url (toJSON auth)
  20. -- vs.
  21. -- res <- post url (encode auth)
Add Comment
Please, Sign In to add comment