aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/FS.purs
diff options
context:
space:
mode:
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)