From b2e9ea5722f612e2147e13ead8e0897413836131 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Wed, 4 Nov 2015 10:51:19 +0300 Subject: Do not abuse Show --- src/ZeroBin.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ZeroBin.hs') 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 -- cgit v1.2.3