aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/Plugin.purs
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2016-03-12 14:55:05 -0500
committereric thul <thul.eric@gmail.com>2016-03-12 14:55:05 -0500
commitcb2f4c886fd1057fbf0511b46cab3489123ced23 (patch)
tree5079dcf661e96520e9b37562b47ab4d83bc7496a /src/PursLoader/Plugin.purs
parent1c49c88ed60341341ab2b82aba738e8fc1179941 (diff)
parent55120f4502cb76e768f60654f3937db809df8ade (diff)
downloadpurs-loader-cb2f4c886fd1057fbf0511b46cab3489123ced23.tar.gz
purs-loader-cb2f4c886fd1057fbf0511b46cab3489123ced23.tar.zst
purs-loader-cb2f4c886fd1057fbf0511b46cab3489123ced23.zip
Merge branch 'master' into topic/stderr
Diffstat (limited to 'src/PursLoader/Plugin.purs')
-rw-r--r--src/PursLoader/Plugin.purs25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/PursLoader/Plugin.purs b/src/PursLoader/Plugin.purs
index c9f0133..8bb53be 100644
--- a/src/PursLoader/Plugin.purs
+++ b/src/PursLoader/Plugin.purs
@@ -1,10 +1,8 @@
1module PursLoader.Plugin 1module PursLoader.Plugin
2 ( Result() 2 ( Compile()
3 , Compile()
4 , Context() 3 , Context()
5 , ImmutableMap() 4 , Options()
6 , DependencyGraph() 5 , DependencyGraph()
7 , get
8 , dependenciesOf 6 , dependenciesOf
9 ) where 7 ) where
10 8
@@ -15,32 +13,19 @@ import Control.Monad.Eff.Exception (Error())
15 13
16import Data.Either (Either(..)) 14import Data.Either (Either(..))
17import Data.Function (Fn4(), runFn4) 15import Data.Function (Fn4(), runFn4)
18import Data.Maybe (Maybe(..))
19import Data.Nullable (Nullable()) 16import Data.Nullable (Nullable())
20 17
21type Result = { srcMap :: ImmutableMap String String, ffiMap :: ImmutableMap String String, graph :: DependencyGraph, output :: String } 18type Compile eff = Nullable Error -> DependencyGraph -> String -> Eff eff Unit
22 19
23type Compile eff = Nullable Error -> Result -> Eff eff Unit 20type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options }
24 21
25type Context eff = { compile :: Compile eff -> Eff eff Unit } 22type Options = { bundle :: Boolean, output :: String, bundleOutput :: String }
26
27get :: forall key value. ImmutableMap key value -> key -> Maybe value
28get = runFn4 getFn Nothing Just
29 23
30dependenciesOf :: DependencyGraph -> String -> Either Error (Array String) 24dependenciesOf :: DependencyGraph -> String -> Either Error (Array String)
31dependenciesOf = runFn4 dependenciesOfFn Left Right 25dependenciesOf = runFn4 dependenciesOfFn Left Right
32 26
33foreign import data ImmutableMap :: * -> * -> *
34
35foreign import data DependencyGraph :: * 27foreign import data DependencyGraph :: *
36 28
37foreign import getFn
38 :: forall key value. Fn4 (Maybe value)
39 (value -> Maybe value)
40 (ImmutableMap key value)
41 key
42 (Maybe value)
43
44foreign import dependenciesOfFn 29foreign import dependenciesOfFn
45 :: Fn4 (Error -> Either Error (Array String)) 30 :: Fn4 (Error -> Either Error (Array String))
46 (Array String -> Either Error (Array String)) 31 (Array String -> Either Error (Array String))