]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/HandleLike.hs
Many changes...
[Lucu.git] / Network / HTTP / Lucu / HandleLike.hs
index aa4dacbee7c3e00983c2f61afda2931fe10edb57..f58264d9c6abd2b3fd5761c7fc0bd6cdfd5782e1 100644 (file)
@@ -1,32 +1,28 @@
+{-# LANGUAGE
+    UnicodeSyntax
+  #-}
 module Network.HTTP.Lucu.HandleLike
     ( HandleLike(..)
     )
     where
-
 import qualified Data.ByteString as B
 import qualified Data.ByteString.Lazy.Char8 as L
 import qualified OpenSSL.Session as SSL
-import           OpenSSL.X509
+import OpenSSL.X509
 import qualified System.IO as I
 
-
 class HandleLike h where
-    hGetLBS :: h -> IO L.ByteString
-    hPutLBS :: h -> L.ByteString -> IO ()
-
-    hGetBS  :: h -> Int -> IO B.ByteString
-    hPutBS  :: h -> B.ByteString -> IO ()
-
-    hPutChar  :: h -> Char -> IO ()
+    hGetLBS ∷ h → IO L.ByteString
+    hPutLBS ∷ h → L.ByteString → IO ()
 
-    hPutStr   :: h -> String -> IO ()
-    hPutStrLn :: h -> String -> IO ()
+    hGetBS  ∷ h → Int → IO B.ByteString
+    hPutBS  ∷ h → B.ByteString → IO ()
 
-    hGetPeerCert :: h -> IO (Maybe X509)
+    hGetPeerCert ∷ h → IO (Maybe X509)
     hGetPeerCert = const $ return Nothing
 
-    hFlush  :: h -> IO ()
-    hClose  :: h -> IO ()
+    hFlush  ∷ h → IO ()
+    hClose  ∷ h → IO ()
 
 
 instance HandleLike I.Handle where
@@ -36,11 +32,6 @@ instance HandleLike I.Handle where
     hGetBS  = B.hGet
     hPutBS  = B.hPut
 
-    hPutChar  = I.hPutChar
-
-    hPutStr   = I.hPutStr
-    hPutStrLn = I.hPutStrLn
-
     hFlush  = I.hFlush
     hClose  = I.hClose
 
@@ -52,11 +43,6 @@ instance HandleLike SSL.SSL where
     hGetBS    = SSL.read
     hPutBS    = SSL.write
 
-    hPutChar  s = hPutLBS s . L.singleton
-
-    hPutStr   s = hPutLBS s . L.pack
-    hPutStrLn s = hPutLBS s . L.pack . (++ "\n")
-
     hGetPeerCert s
         = do isValid <- SSL.getVerifyResult s
              if isValid then