diff options
author | eric <thul.eric@gmail.com> | 2016-01-19 08:41:51 -0500 |
---|---|---|
committer | eric <thul.eric@gmail.com> | 2016-01-19 08:41:51 -0500 |
commit | 2ecf85616a2b56ec9ff675c8f45b7dcf5607fc86 (patch) | |
tree | f8ad39dc0d21ae4add8f2a3877edf24294d2910f /src/PursLoader/LoaderRef.purs | |
parent | 94cc1cdd03b9c2115813a698b1e4337bce894321 (diff) | |
parent | c01553307e6fcd0abada0b9b2f9ca8d6bb82b863 (diff) | |
download | purs-loader-2ecf85616a2b56ec9ff675c8f45b7dcf5607fc86.tar.gz purs-loader-2ecf85616a2b56ec9ff675c8f45b7dcf5607fc86.tar.zst purs-loader-2ecf85616a2b56ec9ff675c8f45b7dcf5607fc86.zip |
Merge pull request #34 from ethul/topic/psc-webpack-plugin
Topic/psc webpack plugin
Diffstat (limited to 'src/PursLoader/LoaderRef.purs')
-rw-r--r-- | src/PursLoader/LoaderRef.purs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/PursLoader/LoaderRef.purs b/src/PursLoader/LoaderRef.purs index 33c4f7e..87d6006 100644 --- a/src/PursLoader/LoaderRef.purs +++ b/src/PursLoader/LoaderRef.purs | |||
@@ -1,6 +1,7 @@ | |||
1 | module PursLoader.LoaderRef | 1 | module PursLoader.LoaderRef |
2 | ( LoaderRef() | 2 | ( LoaderRef() |
3 | , Loader() | 3 | , Loader() |
4 | , AsyncCallback() | ||
4 | , async | 5 | , async |
5 | , cacheable | 6 | , cacheable |
6 | , query | 7 | , query |
@@ -17,16 +18,18 @@ import Control.Monad.Eff.Exception (Error()) | |||
17 | import Data.Function (Fn3(), runFn3) | 18 | import Data.Function (Fn3(), runFn3) |
18 | import Data.Maybe (Maybe(), fromMaybe, isJust) | 19 | import Data.Maybe (Maybe(), fromMaybe, isJust) |
19 | 20 | ||
21 | type AsyncCallback eff = Maybe Error -> String -> Eff (loader :: Loader | eff) Unit | ||
22 | |||
20 | data LoaderRef | 23 | data LoaderRef |
21 | 24 | ||
22 | foreign import data Loader :: ! | 25 | foreign import data Loader :: ! |
23 | 26 | ||
24 | foreign import asyncFn :: forall eff a. Fn3 (Maybe Error -> Boolean) | 27 | foreign import asyncFn :: forall eff. Fn3 (Maybe Error -> Boolean) |
25 | (Error -> Maybe Error -> Error) | 28 | (Error -> Maybe Error -> Error) |
26 | LoaderRef | 29 | LoaderRef |
27 | (Eff (loader :: Loader | eff) (Maybe Error -> a -> Eff (loader :: Loader | eff) Unit)) | 30 | (Eff (loader :: Loader | eff) (AsyncCallback eff)) |
28 | 31 | ||
29 | async :: forall eff a. LoaderRef -> Eff (loader :: Loader | eff) (Maybe Error -> a -> Eff (loader :: Loader | eff) Unit) | 32 | async :: forall eff. LoaderRef -> Eff (loader :: Loader | eff) (Maybe Error -> String -> Eff (loader :: Loader | eff) Unit) |
30 | async ref = runFn3 asyncFn isJust fromMaybe ref | 33 | async ref = runFn3 asyncFn isJust fromMaybe ref |
31 | 34 | ||
32 | foreign import cacheable :: forall eff. LoaderRef -> Eff (loader :: Loader | eff) Unit | 35 | foreign import cacheable :: forall eff. LoaderRef -> Eff (loader :: Loader | eff) Unit |