diff options
author | eric <thul.eric@gmail.com> | 2016-03-12 14:46:01 -0500 |
---|---|---|
committer | eric <thul.eric@gmail.com> | 2016-03-12 14:46:01 -0500 |
commit | 55120f4502cb76e768f60654f3937db809df8ade (patch) | |
tree | f27800de3576466ea4d5502d9adb9cd57a583715 /src/PursLoader/Plugin.purs | |
parent | 17f22f868b851e50081844562627a7a8a414dcaa (diff) | |
parent | 845f3ec3c5b13a47d60b9ff2be14bf41fb5c4734 (diff) | |
download | purs-loader-55120f4502cb76e768f60654f3937db809df8ade.tar.gz purs-loader-55120f4502cb76e768f60654f3937db809df8ade.tar.zst purs-loader-55120f4502cb76e768f60654f3937db809df8ade.zip |
Merge pull request #43 from ethul/topic/optional-bundle
Handle optional bundling by the compiler
Diffstat (limited to 'src/PursLoader/Plugin.purs')
-rw-r--r-- | src/PursLoader/Plugin.purs | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/PursLoader/Plugin.purs b/src/PursLoader/Plugin.purs index 23f8600..c798c83 100644 --- a/src/PursLoader/Plugin.purs +++ b/src/PursLoader/Plugin.purs | |||
@@ -1,10 +1,8 @@ | |||
1 | module PursLoader.Plugin | 1 | module 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 | ||
16 | import Data.Either (Either(..)) | 14 | import Data.Either (Either(..)) |
17 | import Data.Function (Fn4(), runFn4) | 15 | import Data.Function (Fn4(), runFn4) |
18 | import Data.Maybe (Maybe(..)) | ||
19 | import Data.Nullable (Nullable()) | 16 | import Data.Nullable (Nullable()) |
20 | 17 | ||
21 | type Result = { srcMap :: ImmutableMap String String, ffiMap :: ImmutableMap String String, graph :: DependencyGraph } | 18 | type Compile eff = Nullable Error -> DependencyGraph -> Eff eff Unit |
22 | 19 | ||
23 | type Compile eff = Nullable Error -> Result -> Eff eff Unit | 20 | type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } |
24 | 21 | ||
25 | type Context eff = { compile :: Compile eff -> Eff eff Unit } | 22 | type Options = { bundle :: Boolean, output :: String, bundleOutput :: String } |
26 | |||
27 | get :: forall key value. ImmutableMap key value -> key -> Maybe value | ||
28 | get = runFn4 getFn Nothing Just | ||
29 | 23 | ||
30 | dependenciesOf :: DependencyGraph -> String -> Either Error (Array String) | 24 | dependenciesOf :: DependencyGraph -> String -> Either Error (Array String) |
31 | dependenciesOf = runFn4 dependenciesOfFn Left Right | 25 | dependenciesOf = runFn4 dependenciesOfFn Left Right |
32 | 26 | ||
33 | foreign import data ImmutableMap :: * -> * -> * | ||
34 | |||
35 | foreign import data DependencyGraph :: * | 27 | foreign import data DependencyGraph :: * |
36 | 28 | ||
37 | foreign import getFn | ||
38 | :: forall key value. Fn4 (Maybe value) | ||
39 | (value -> Maybe value) | ||
40 | (ImmutableMap key value) | ||
41 | key | ||
42 | (Maybe value) | ||
43 | |||
44 | foreign import dependenciesOfFn | 29 | foreign 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)) |