aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/Glob.purs
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2015-08-11 20:57:07 -0400
committereric thul <thul.eric@gmail.com>2015-08-11 20:57:07 -0400
commit03b840cb5fb8ff5217fefc9e1240a3131db309fc (patch)
tree6183f4453aa15ad67ee0249fb8d35702cef5ecad /src/PursLoader/Glob.purs
parentfa01c5a4cb42d80ac147dc5ab512a0795dbe14da (diff)
downloadpurs-loader-03b840cb5fb8ff5217fefc9e1240a3131db309fc.tar.gz
purs-loader-03b840cb5fb8ff5217fefc9e1240a3131db309fc.tar.zst
purs-loader-03b840cb5fb8ff5217fefc9e1240a3131db309fc.zip
PureScript 0.7 updates and migration to pulp
Diffstat (limited to 'src/PursLoader/Glob.purs')
-rw-r--r--src/PursLoader/Glob.purs25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/PursLoader/Glob.purs b/src/PursLoader/Glob.purs
index 392d9e4..45eeb56 100644
--- a/src/PursLoader/Glob.purs
+++ b/src/PursLoader/Glob.purs
@@ -3,6 +3,8 @@ module PursLoader.Glob
3 , globAll 3 , globAll
4 ) where 4 ) where
5 5
6import Prelude (Unit(), ($))
7
6import Control.Monad.Aff (Aff(), makeAff) 8import Control.Monad.Aff (Aff(), makeAff)
7import Control.Monad.Eff (Eff()) 9import Control.Monad.Eff (Eff())
8import Control.Monad.Eff.Exception (Error()) 10import Control.Monad.Eff.Exception (Error())
@@ -11,23 +13,10 @@ import Data.Function
11 13
12foreign import data Glob :: ! 14foreign import data Glob :: !
13 15
14globAll :: forall eff. [String] -> Aff (glob :: Glob | eff) [[String]] 16globAll :: forall eff. Array String -> Aff (glob :: Glob | eff) (Array (Array String))
15globAll patterns = makeAff $ runFn3 globAllFn patterns 17globAll patterns = makeAff $ runFn3 globAllFn patterns
16 18
17foreign import globAllFn """ 19foreign import globAllFn :: forall eff. Fn3 (Array String)
18function globAllFn(patterns, errback, callback) { 20 (Error -> Eff (glob :: Glob | eff) Unit)
19 return function(){ 21 ((Array (Array String)) -> Eff (glob :: Glob | eff) Unit)
20 var glob = require('glob'); 22 (Eff (glob :: Glob | eff) Unit)
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)