1
1
module Network.HTTP.Affjax
2
- ( Ajax ()
2
+ ( AJAX ()
3
3
, Affjax ()
4
4
, AffjaxRequest (), defaultRequest
5
5
, AffjaxResponse ()
@@ -12,7 +12,7 @@ module Network.HTTP.Affjax
12
12
, delete , delete_
13
13
) where
14
14
15
- import Control.Monad.Aff (Aff (), makeAff , makeAff' , Canceler ())
15
+ import Control.Monad.Aff (Aff (), makeAff , makeAff' , Canceler (.. ))
16
16
import Control.Monad.Eff (Eff ())
17
17
import Control.Monad.Eff.Exception (Error (), error )
18
18
import Data.Either (Either (..))
@@ -31,10 +31,10 @@ import Network.HTTP.StatusCode (StatusCode())
31
31
import Type.Proxy (Proxy (..))
32
32
33
33
-- | The effect type for AJAX requests made with Affjax.
34
- foreign import data Ajax :: !
34
+ foreign import data AJAX :: !
35
35
36
36
-- | 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 )
38
38
39
39
type AffjaxRequest a =
40
40
{ method :: Method
@@ -120,9 +120,9 @@ delete_ = delete
120
120
-- | Run a request directly without using `Aff`.
121
121
affjax' :: forall e a b . (Requestable a , Responsable b ) =>
122
122
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 ))
126
126
affjax' req eb cb =
127
127
runFn5 _ajax responseHeader req' cancelAjax eb cb'
128
128
where
@@ -135,7 +135,7 @@ affjax' req eb cb =
135
135
, username: toNullable req.username
136
136
, password: toNullable req.password
137
137
}
138
- cb' :: AffjaxResponse ResponseContent -> Eff (ajax :: Ajax | e ) Unit
138
+ cb' :: AffjaxResponse ResponseContent -> Eff (ajax :: AJAX | e ) Unit
139
139
cb' res = case res { response = _ } <$> fromResponse res .response of
140
140
Left err -> eb $ error (show err )
141
141
Right res' -> cb res'
@@ -185,13 +185,13 @@ foreign import _ajax
185
185
}
186
186
" " " :: forall e a . Fn5 (String -> String -> ResponseHeader )
187
187
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 )))
192
192
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)
195
195
196
196
foreign import _cancelAjax
197
197
" " "
@@ -203,6 +203,6 @@ foreign import _cancelAjax
203
203
};
204
204
" " " :: forall e . Fn4 XMLHttpRequest
205
205
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