]>
Commit | Line | Data |
---|---|---|
0e1221d7 | 1 | module PursLoader.FS |
2 | ( FS() | |
3 | , writeFileUtf8 | |
3610dff1 | 4 | , findFileUtf8 |
0e1221d7 | 5 | ) where |
6 | ||
03b840cb | 7 | import Prelude (Unit(), ($)) |
8 | ||
0e1221d7 | 9 | import Control.Monad.Aff (Aff(), makeAff) |
10 | import Control.Monad.Eff (Eff()) | |
11 | import Control.Monad.Eff.Exception (Error()) | |
12 | ||
3610dff1 | 13 | import Data.Maybe (Maybe(..)) |
14 | import Data.String.Regex (Regex()) | |
15 | ||
0e1221d7 | 16 | import Data.Function |
17 | ||
18 | foreign import data FS :: ! | |
19 | ||
20 | writeFileUtf8 :: forall eff. String -> String -> Aff (fs :: FS | eff) Unit | |
21 | writeFileUtf8 filepath contents = makeAff $ runFn4 writeFileUtf8Fn filepath contents | |
22 | ||
03b840cb | 23 | foreign 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) | |
3610dff1 | 28 | |
03b840cb | 29 | findFileUtf8 :: forall eff. Regex -> Array String -> Aff (fs :: FS | eff) (Maybe String) |
3610dff1 | 30 | findFileUtf8 regexp filepaths = makeAff $ runFn6 findFileUtf8Fn Nothing Just regexp filepaths |
31 | ||
03b840cb | 32 | foreign 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) |