aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/LoaderRef.purs
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2015-12-25 18:41:33 -0500
committereric thul <thul.eric@gmail.com>2015-12-25 18:41:33 -0500
commit63d6a244462d050e119bde54a7063bae8a17e987 (patch)
treecce47ed541fa9ee8b2950945a89608b1c06fb8c9 /src/PursLoader/LoaderRef.purs
parent2e2da2be94720a739c595ec179a7ed49480ce753 (diff)
downloadpurs-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.purs13
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 @@
1module PursLoader.LoaderRef 1module 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())
17import Data.Function (Fn3(), runFn3) 18import Data.Function (Fn3(), runFn3)
18import Data.Maybe (Maybe(), fromMaybe, isJust) 19import Data.Maybe (Maybe(), fromMaybe, isJust)
19 20
21type AsyncCallback eff = Maybe Error -> String -> Eff (loader :: Loader | eff) Unit
22
20data LoaderRef 23data LoaderRef
21 24
22foreign import data Loader :: ! 25foreign import data Loader :: !
23 26
24foreign import asyncFn :: forall eff a. Fn3 (Maybe Error -> Boolean) 27foreign 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
29async :: forall eff a. LoaderRef -> Eff (loader :: Loader | eff) (Maybe Error -> a -> Eff (loader :: Loader | eff) Unit) 32async :: forall eff. LoaderRef -> Eff (loader :: Loader | eff) (Maybe Error -> String -> Eff (loader :: Loader | eff) Unit)
30async ref = runFn3 asyncFn isJust fromMaybe ref 33async ref = runFn3 asyncFn isJust fromMaybe ref
31 34
32foreign import cacheable :: forall eff. LoaderRef -> Eff (loader :: Loader | eff) Unit 35foreign import cacheable :: forall eff. LoaderRef -> Eff (loader :: Loader | eff) Unit