aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/meta/compiler/meta/cache.lux
blob: 97e0aa792c0b4336d83f83f859792f31f4a13361 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only Monad do)]]
   [control
    ["[0]" try (.only Try)]]
   [world
    ["[0]" file]]]])

(def .public path
  file.Path
  "cache")

(def .public (enabled? fs)
  (All (_ !)
    (-> (file.System !)
        (! Bit)))
  (of fs directory? ..path))

(def .public (enable! ! fs)
  (All (_ !)
    (-> (Monad !) (file.System !)
        (! (Try Any))))
  (do !
    [? (..enabled? fs)]
    (if ?
      (in {try.#Success []})
      (file.make_directories ! fs ..path))))