Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ftp-client-conduit/src/Network/FTP/Client/Conduit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ debugPrint s = debugPrint' s debugging
debugResponse :: (Show a, MonadIO m) => a -> m ()
debugResponse s = debugPrint $ "Recieved: " <> (show s)

getAllLineRespC :: MonadIO m => FTP.Handle -> Producer m ByteString
getAllLineRespC :: MonadIO m => FTP.Handle -> ConduitT i ByteString m ()
getAllLineRespC h = loop
where
loop = do
Expand All @@ -70,7 +70,7 @@ getAllLineRespC h = loop
yield line
loop

sendAllLineC :: MonadIO m => FTP.Handle -> Consumer ByteString m ()
sendAllLineC :: MonadIO m => FTP.Handle -> ConduitT ByteString o m ()
sendAllLineC h = loop
where
loop = do
Expand Down Expand Up @@ -130,7 +130,7 @@ sourceTLSDataCommand ch pa code cmd f = do
debugResponse resp
return x

sourceFTPHandle :: MonadIO m => FTP.Handle -> Producer m ByteString
sourceFTPHandle :: MonadIO m => FTP.Handle -> ConduitT i ByteString m ()
sourceFTPHandle h = loop
where
loop = do
Expand All @@ -142,7 +142,7 @@ sourceFTPHandle h = loop
yield bs
loop

sinkFTPHandle :: MonadIO m => FTP.Handle -> Consumer ByteString m ()
sinkFTPHandle :: MonadIO m => FTP.Handle -> ConduitT ByteString o m ()
sinkFTPHandle h = loop
where
loop = do
Expand All @@ -157,19 +157,19 @@ sendType
:: MonadResource m
=> RTypeCode
-> FTP.Handle
-> Consumer ByteString m ()
-> ConduitT ByteString o m ()
sendType TA h = sendAllLineC h
sendType TI h = sinkFTPHandle h

nlst :: MonadResource m => FTP.Handle -> [String] -> Producer m ByteString
nlst :: MonadResource m => FTP.Handle -> [String] -> ConduitT i ByteString m ()
nlst ch args =
sourceDataCommandSecurity ch Passive TA (Nlst args) getAllLineRespC

retr :: MonadResource m => FTP.Handle -> String -> Producer m ByteString
retr :: MonadResource m => FTP.Handle -> String -> ConduitT i ByteString m ()
retr ch path =
sourceDataCommandSecurity ch Passive TI (Retr path) sourceFTPHandle

list :: MonadResource m => FTP.Handle -> [String] -> Producer m ByteString
list :: MonadResource m => FTP.Handle -> [String] -> ConduitT i ByteString m ()
list ch args =
sourceDataCommandSecurity ch Passive TA (List args) getAllLineRespC

Expand All @@ -178,15 +178,15 @@ stor
=> FTP.Handle
-> String
-> RTypeCode
-> Consumer ByteString m ()
-> ConduitT ByteString o m ()
stor ch loc rtype =
sourceDataCommandSecurity ch Passive rtype (Stor loc) $ sendType rtype

mlsd
:: MonadResource m
=> FTP.Handle
-> String
-> Producer m FTP.MlsxResponse
-> ConduitT i FTP.MlsxResponse m ()
mlsd ch dir =
sourceDataCommandSecurity ch Passive TA (Mlsd dir) getAllLineRespC
.| mapC parseMlsxLine