From 1983893bf09a5c2ea1946e156be5da170075af7e Mon Sep 17 00:00:00 2001 From: eric thul Date: Sun, 5 Jul 2015 10:13:47 -0400 Subject: Updating for PureScript 0.7 Resolves #14 --- src/Glob.purs | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 src/Glob.purs (limited to 'src/Glob.purs') diff --git a/src/Glob.purs b/src/Glob.purs deleted file mode 100644 index 7bc9212..0000000 --- a/src/Glob.purs +++ /dev/null @@ -1,31 +0,0 @@ -module PursLoader.Glob - ( Glob() - , glob - ) where - -import Control.Monad.Aff (Aff(), makeAff) -import Control.Monad.Eff (Eff()) -import Control.Monad.Eff.Exception (Error()) - -import Data.Function - -foreign import data Glob :: ! - -glob :: forall eff. String -> Aff (glob :: Glob | eff) [String] -glob pattern = makeAff $ runFn3 globFn pattern - -foreign import globFn """ -function globFn(pattern, errback, callback) { - return function(){ - var glob = require('glob'); - - glob(pattern, function(e, data){ - if (e) errback(e)(); - else callback(data)(); - }); - }; -} -""" :: forall eff. Fn3 String - (Error -> Eff (glob :: Glob | eff) Unit) - ([String] -> Eff (glob :: Glob | eff) Unit) - (Eff (glob :: Glob | eff) Unit) -- cgit v1.2.3 From 0e1221d7b15e578d5e9146b01e11a24007d4ba9b Mon Sep 17 00:00:00 2001 From: eric thul Date: Mon, 6 Jul 2015 23:49:47 -0400 Subject: Generate .psci file Resolves #11 --- src/Glob.purs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/Glob.purs (limited to 'src/Glob.purs') diff --git a/src/Glob.purs b/src/Glob.purs new file mode 100644 index 0000000..392d9e4 --- /dev/null +++ b/src/Glob.purs @@ -0,0 +1,33 @@ +module PursLoader.Glob + ( Glob() + , globAll + ) where + +import Control.Monad.Aff (Aff(), makeAff) +import Control.Monad.Eff (Eff()) +import Control.Monad.Eff.Exception (Error()) + +import Data.Function + +foreign import data Glob :: ! + +globAll :: forall eff. [String] -> Aff (glob :: Glob | eff) [[String]] +globAll patterns = makeAff $ runFn3 globAllFn patterns + +foreign import globAllFn """ +function globAllFn(patterns, errback, callback) { + return function(){ + var glob = require('glob'); + + var async = require('async'); + + async.map(patterns, glob, function(error, result){ + if (error) errback(new Error(error))(); + else callback(result)(); + }); + }; +} +""" :: forall eff. Fn3 [String] + (Error -> Eff (glob :: Glob | eff) Unit) + ([[String]] -> Eff (glob :: Glob | eff) Unit) + (Eff (glob :: Glob | eff) Unit) -- cgit v1.2.3