aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/Glob.purs
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2015-08-11 20:27:04 -0400
committereric thul <thul.eric@gmail.com>2015-08-11 20:27:04 -0400
commitfa01c5a4cb42d80ac147dc5ab512a0795dbe14da (patch)
tree8bdb1f4c24a31c7fd5c69fcd804e8428ae6c49b6 /src/PursLoader/Glob.purs
parenteae2e182cec2d521166e5775294b52300c42f069 (diff)
downloadpurs-loader-fa01c5a4cb42d80ac147dc5ab512a0795dbe14da.tar.gz
purs-loader-fa01c5a4cb42d80ac147dc5ab512a0795dbe14da.tar.zst
purs-loader-fa01c5a4cb42d80ac147dc5ab512a0795dbe14da.zip
Moving files to match module
Diffstat (limited to 'src/PursLoader/Glob.purs')
-rw-r--r--src/PursLoader/Glob.purs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/PursLoader/Glob.purs b/src/PursLoader/Glob.purs
new file mode 100644
index 0000000..392d9e4
--- /dev/null
+++ b/src/PursLoader/Glob.purs
@@ -0,0 +1,33 @@
1module PursLoader.Glob
2 ( Glob()
3 , globAll
4 ) where
5
6import Control.Monad.Aff (Aff(), makeAff)
7import Control.Monad.Eff (Eff())
8import Control.Monad.Eff.Exception (Error())
9
10import Data.Function
11
12foreign import data Glob :: !
13
14globAll :: forall eff. [String] -> Aff (glob :: Glob | eff) [[String]]
15globAll patterns = makeAff $ runFn3 globAllFn patterns
16
17foreign import globAllFn """
18function globAllFn(patterns, errback, callback) {
19 return function(){
20 var glob = require('glob');
21
22 var async = require('async');
23
24 async.map(patterns, glob, function(error, result){
25 if (error) errback(new Error(error))();
26 else callback(result)();
27 });
28 };
29}
30""" :: forall eff. Fn3 [String]
31 (Error -> Eff (glob :: Glob | eff) Unit)
32 ([[String]] -> Eff (glob :: Glob | eff) Unit)
33 (Eff (glob :: Glob | eff) Unit)