]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Abortion.hs
Code reorganisation
[Lucu.git] / Network / HTTP / Lucu / Abortion.hs
index 064a97ebd8671232b9053a6382d93c85927df318..3dc94c2c52a281876b9e7fdff3241184107c00c9 100644 (file)
@@ -1,8 +1,9 @@
 {-# LANGUAGE
-    UnicodeSyntax
+    FlexibleContexts
+  , UnicodeSyntax
   #-}
--- |Aborting the computation of 'Network.HTTP.Lucu.Resource.Resource'
--- in any 'Prelude.IO' monads or arrows.
+-- |Aborting the computation of 'Network.HTTP.Lucu.Rsrc' in any 'IO'
+-- monads.
 module Network.HTTP.Lucu.Abortion
     ( Abortion
     , mkAbortion
@@ -14,21 +15,25 @@ module Network.HTTP.Lucu.Abortion
 import Control.Exception
 import Control.Monad.Trans
 import Data.Ascii (Ascii, CIAscii)
+import Data.Collections
 import Data.Monoid.Unicode
 import Data.Text (Text)
 import Network.HTTP.Lucu.Abortion.Internal
-import Network.HTTP.Lucu.Headers
-import Network.HTTP.Lucu.Response
+import Network.HTTP.Lucu.Response.StatusCode
 import Prelude.Unicode
 
 -- |Construct an 'Abortion' with additional headers and an optional
 -- message text.
-mkAbortion ∷ StatusCode sc ⇒ sc → [(CIAscii, Ascii)] → Maybe Text → Abortion
+mkAbortion ∷ (StatusCode sc, Foldable f (CIAscii, Ascii))
+           ⇒ sc
+           → f
+           → Maybe Text
+           → Abortion
 {-# INLINE mkAbortion #-}
-mkAbortion sc hdr msg
+mkAbortion sc hdrs msg
     = Abortion {
         aboStatus  = fromStatusCode sc
-      , aboHeaders = toHeaders hdr
+      , aboHeaders = fromFoldable hdrs
       , aboMessage = msg
       }
 
@@ -44,7 +49,7 @@ mkAbortion' sc msg
       }
 
 -- |Throw an 'Abortion' in a 'MonadIO', including the very
--- 'Network.HTTP.Lucu.Resource.Resource' monad.
+-- 'Network.HTTP.Lucu.Rsrc' monad.
 abort ∷ MonadIO m ⇒ Abortion → m a
 {-# INLINE abort #-}
 abort = liftIO ∘ throwIO