diff options
Diffstat (limited to 'src/PursLoader/Plugin.purs')
-rw-r--r-- | src/PursLoader/Plugin.purs | 22 |
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 @@ | |||
1 | module PursLoader.Plugin | 1 | module 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 | ||
17 | import Data.Either (Either(..)) | 14 | import Data.Either (Either(..)) |
18 | import Data.Function (Fn4(), runFn4) | 15 | import Data.Function (Fn4(), runFn4) |
19 | import Data.Maybe (Maybe(..)) | ||
20 | import Data.Nullable (Nullable()) | 16 | import Data.Nullable (Nullable()) |
21 | 17 | ||
22 | type Result = { srcMap :: ImmutableMap String String, ffiMap :: ImmutableMap String String, graph :: DependencyGraph } | 18 | type Compile eff = Nullable Error -> DependencyGraph -> Eff eff Unit |
23 | |||
24 | type Compile eff = Nullable Error -> Result -> Eff eff Unit | ||
25 | 19 | ||
26 | type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } | 20 | type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } |
27 | 21 | ||
28 | type Options = { bundle :: Boolean, output :: String, bundleOutput :: String } | 22 | type Options = { bundle :: Boolean, output :: String, bundleOutput :: String } |
29 | 23 | ||
30 | get :: forall key value. ImmutableMap key value -> key -> Maybe value | ||
31 | get = runFn4 getFn Nothing Just | ||
32 | |||
33 | dependenciesOf :: DependencyGraph -> String -> Either Error (Array String) | 24 | dependenciesOf :: DependencyGraph -> String -> Either Error (Array String) |
34 | dependenciesOf = runFn4 dependenciesOfFn Left Right | 25 | dependenciesOf = runFn4 dependenciesOfFn Left Right |
35 | 26 | ||
36 | foreign import data ImmutableMap :: * -> * -> * | ||
37 | |||
38 | foreign import data DependencyGraph :: * | 27 | foreign import data DependencyGraph :: * |
39 | 28 | ||
40 | foreign import getFn | ||
41 | :: forall key value. Fn4 (Maybe value) | ||
42 | (value -> Maybe value) | ||
43 | (ImmutableMap key value) | ||
44 | key | ||
45 | (Maybe value) | ||
46 | |||
47 | foreign import dependenciesOfFn | 29 | foreign 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)) |