diff options
author | eric thul <thul.eric@gmail.com> | 2015-12-25 18:41:33 -0500 |
---|---|---|
committer | eric thul <thul.eric@gmail.com> | 2015-12-25 18:41:33 -0500 |
commit | 63d6a244462d050e119bde54a7063bae8a17e987 (patch) | |
tree | cce47ed541fa9ee8b2950945a89608b1c06fb8c9 /src/PursLoader/LoaderRef.purs | |
parent | 2e2da2be94720a739c595ec179a7ed49480ce753 (diff) | |
download | purs-loader-63d6a244462d050e119bde54a7063bae8a17e987.tar.gz purs-loader-63d6a244462d050e119bde54a7063bae8a17e987.tar.zst purs-loader-63d6a244462d050e119bde54a7063bae8a17e987.zip |
Splitting PSC functionality into a separate plugin
The loader creates shim modules that reference their corresponding
PureScript module that is bundled by the PureScript webpack plugin,
which invokes `psc` and `psc-bundle`.
Resolves #31 and resolves #32
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 |