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