aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/FS.purs
diff options
context:
space:
mode:
authoreric <thul.eric@gmail.com>2015-08-11 21:23:46 -0400
committereric <thul.eric@gmail.com>2015-08-11 21:23:46 -0400
commit7226ff961c104037e8e5d3705949e2e9d58a6727 (patch)
tree555547366ccadfe71689b95a6b16b855b6173364 /src/PursLoader/FS.purs
parenteae2e182cec2d521166e5775294b52300c42f069 (diff)
parent07de44be15efb0ca9a2d1443ab1e91076a25409c (diff)
downloadpurs-loader-7226ff961c104037e8e5d3705949e2e9d58a6727.tar.gz
purs-loader-7226ff961c104037e8e5d3705949e2e9d58a6727.tar.zst
purs-loader-7226ff961c104037e8e5d3705949e2e9d58a6727.zip
Merge pull request #27 from ethul/topic/issue-26
Topic/issue 26
Diffstat (limited to 'src/PursLoader/FS.purs')
-rw-r--r--src/PursLoader/FS.purs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/PursLoader/FS.purs b/src/PursLoader/FS.purs
new file mode 100644
index 0000000..969e3d0
--- /dev/null
+++ b/src/PursLoader/FS.purs
@@ -0,0 +1,38 @@
1module PursLoader.FS
2 ( FS()
3 , writeFileUtf8
4 , findFileUtf8
5 ) where
6
7import Prelude (Unit(), ($))
8
9import Control.Monad.Aff (Aff(), makeAff)
10import Control.Monad.Eff (Eff())
11import Control.Monad.Eff.Exception (Error())
12
13import Data.Maybe (Maybe(..))
14import Data.String.Regex (Regex())
15
16import Data.Function
17
18foreign import data FS :: !
19
20writeFileUtf8 :: forall eff. String -> String -> Aff (fs :: FS | eff) Unit
21writeFileUtf8 filepath contents = makeAff $ runFn4 writeFileUtf8Fn filepath contents
22
23foreign import writeFileUtf8Fn :: forall eff. Fn4 String
24 String
25 (Error -> Eff (fs :: FS | eff) Unit)
26 (Unit -> Eff (fs :: FS | eff) Unit)
27 (Eff (fs :: FS | eff) Unit)
28
29findFileUtf8 :: forall eff. Regex -> Array String -> Aff (fs :: FS | eff) (Maybe String)
30findFileUtf8 regexp filepaths = makeAff $ runFn6 findFileUtf8Fn Nothing Just regexp filepaths
31
32foreign import findFileUtf8Fn :: forall eff. Fn6 (Maybe String)
33 (String -> Maybe String)
34 Regex
35 (Array String)
36 (Error -> Eff (fs :: FS | eff) Unit)
37 (Maybe String -> Eff (fs :: FS | eff) Unit)
38 (Eff (fs :: FS | eff) Unit)