]> git.immae.eu Git - github/fretlink/purs-loader.git/blob - src/PursLoader/FS.purs
PureScript 0.7 updates and migration to pulp
[github/fretlink/purs-loader.git] / src / PursLoader / FS.purs
1 module PursLoader.FS
2 ( FS()
3 , writeFileUtf8
4 , findFileUtf8
5 ) where
6
7 import Prelude (Unit(), ($))
8
9 import Control.Monad.Aff (Aff(), makeAff)
10 import Control.Monad.Eff (Eff())
11 import Control.Monad.Eff.Exception (Error())
12
13 import Data.Maybe (Maybe(..))
14 import Data.String.Regex (Regex())
15
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
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)
28
29 findFileUtf8 :: forall eff. Regex -> Array String -> Aff (fs :: FS | eff) (Maybe String)
30 findFileUtf8 regexp filepaths = makeAff $ runFn6 findFileUtf8Fn Nothing Just regexp filepaths
31
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)