aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-11-04 10:51:19 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-11-04 10:51:19 +0300
commitb2e9ea5722f612e2147e13ead8e0897413836131 (patch)
tree69b3afb737f5d75abb6953dce48cb598882fb670 /src
parentc065fc6a2e399cd807b2ab74ad0fe4be0d2c6859 (diff)
downloadzerobin-b2e9ea5722f612e2147e13ead8e0897413836131.tar.gz
Do not abuse Show
Diffstat (limited to 'src')
-rw-r--r--src/ZeroBin.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ZeroBin.hs b/src/ZeroBin.hs
index fac93a5..5d8abd8 100644
--- a/src/ZeroBin.hs
+++ b/src/ZeroBin.hs
@@ -30,18 +30,18 @@ data Expiration
| Month
| Never
-instance Show Expiration where
- show Once = "burn_after_reading"
- show Day = "1_day"
- show Week = "1_week"
- show Month = "1_month"
- show Never = "never"
+form :: Expiration -> String
+form Once = "burn_after_reading"
+form Day = "1_day"
+form Week = "1_week"
+form Month = "1_month"
+form Never = "never"
post :: String -> Expiration -> Content -> IO (Either String String)
post bin ex ct = do
req' <- HTTP.parseUrl $ bin ++ "/paste/create"
let req = HTTP.urlEncodedBody
- [ (C.pack "expiration" , C.pack $ show ex)
+ [ (C.pack "expiration" , C.pack $ form ex)
, (C.pack "content" , L.toStrict $ JSON.encode ct)
] req'
manager <- HTTP.newManager HTTP.tlsManagerSettings