11module Network.HTTP.Affjax
2- ( Ajax ()
2+ ( AJAX ()
33 , Affjax ()
44 , AffjaxRequest (), defaultRequest
55 , AffjaxResponse ()
@@ -12,7 +12,7 @@ module Network.HTTP.Affjax
1212 , delete , delete_
1313 ) where
1414
15- import Control.Monad.Aff (Aff (), makeAff , makeAff' , Canceler ())
15+ import Control.Monad.Aff (Aff (), makeAff , makeAff' , Canceler (.. ))
1616import Control.Monad.Eff (Eff ())
1717import Control.Monad.Eff.Exception (Error (), error )
1818import Data.Either (Either (..))
@@ -31,10 +31,10 @@ import Network.HTTP.StatusCode (StatusCode())
3131import Type.Proxy (Proxy (..))
3232
3333-- | The effect type for AJAX requests made with Affjax.
34- foreign import data Ajax :: !
34+ foreign import data AJAX :: !
3535
3636-- | The type for Affjax requests.
37- type Affjax e a = Aff (ajax :: Ajax | e ) (AffjaxResponse a )
37+ type Affjax e a = Aff (ajax :: AJAX | e ) (AffjaxResponse a )
3838
3939type AffjaxRequest a =
4040 { method :: Method
@@ -120,9 +120,9 @@ delete_ = delete
120120-- | Run a request directly without using `Aff`.
121121affjax' :: forall e a b . (Requestable a , Responsable b ) =>
122122 AffjaxRequest a ->
123- (Error -> Eff (ajax :: Ajax | e ) Unit ) ->
124- (AffjaxResponse b -> Eff (ajax :: Ajax | e ) Unit ) ->
125- Eff (ajax :: Ajax | e ) (Canceler (ajax :: Ajax | e ))
123+ (Error -> Eff (ajax :: AJAX | e ) Unit ) ->
124+ (AffjaxResponse b -> Eff (ajax :: AJAX | e ) Unit ) ->
125+ Eff (ajax :: AJAX | e ) (Canceler (ajax :: AJAX | e ))
126126affjax' req eb cb =
127127 runFn5 _ajax responseHeader req' cancelAjax eb cb'
128128 where
@@ -135,7 +135,7 @@ affjax' req eb cb =
135135 , username: toNullable req.username
136136 , password: toNullable req.password
137137 }
138- cb' :: AffjaxResponse ResponseContent -> Eff (ajax :: Ajax | e ) Unit
138+ cb' :: AffjaxResponse ResponseContent -> Eff (ajax :: AJAX | e ) Unit
139139 cb' res = case res { response = _ } <$> fromResponse res .response of
140140 Left err -> eb $ error (show err )
141141 Right res' -> cb res'
@@ -185,13 +185,13 @@ foreign import _ajax
185185 }
186186 " " " :: forall e a . Fn5 (String -> String -> ResponseHeader )
187187 AjaxRequest
188- (XMLHttpRequest -> Canceler (ajax :: Ajax | e ))
189- (Error -> Eff (ajax :: Ajax | e ) Unit )
190- (AffjaxResponse Foreign -> Eff (ajax :: Ajax | e ) Unit )
191- (Eff (ajax :: Ajax | e ) (Canceler (ajax :: Ajax | e )))
188+ (XMLHttpRequest -> Canceler (ajax :: AJAX | e ))
189+ (Error -> Eff (ajax :: AJAX | e ) Unit )
190+ (AffjaxResponse Foreign -> Eff (ajax :: AJAX | e ) Unit )
191+ (Eff (ajax :: AJAX | e ) (Canceler (ajax :: AJAX | e )))
192192
193- cancelAjax :: forall e . XMLHttpRequest -> Canceler (ajax :: Ajax | e )
194- cancelAjax xhr err = makeAff (\eb cb -> runFn4 _cancelAjax xhr err eb cb)
193+ cancelAjax :: forall e . XMLHttpRequest -> Canceler (ajax :: AJAX | e )
194+ cancelAjax xhr = Canceler \ err -> makeAff (\eb cb -> runFn4 _cancelAjax xhr err eb cb)
195195
196196foreign import _cancelAjax
197197 " " "
@@ -203,6 +203,6 @@ foreign import _cancelAjax
203203 };
204204 " " " :: forall e . Fn4 XMLHttpRequest
205205 Error
206- (Error -> Eff (ajax :: Ajax | e ) Unit )
207- (Boolean -> Eff (ajax :: Ajax | e ) Unit )
208- (Eff (ajax :: Ajax | e ) Unit )
206+ (Error -> Eff (ajax :: AJAX | e ) Unit )
207+ (Boolean -> Eff (ajax :: AJAX | e ) Unit )
208+ (Eff (ajax :: AJAX | e ) Unit )
0 commit comments