[dhall] Add Prelude (v23.0.0)
This commit is contained in:
parent
6926168fb3
commit
bb6baa8e0b
401 changed files with 8043 additions and 1 deletions
3
dhall/Prelude/Bool/and
Normal file
3
dhall/Prelude/Bool/and
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:0b2114fa33cd76652e4360f012bc082718944fe4c5b28c975483178f8d9b0a6d
|
||||||
|
? ./and.dhall
|
14
dhall/Prelude/Bool/and.dhall
Normal file
14
dhall/Prelude/Bool/and.dhall
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{-|
|
||||||
|
The `and` function returns `False` if there are any `False` elements in the
|
||||||
|
`List` and returns `True` otherwise
|
||||||
|
-}
|
||||||
|
let and
|
||||||
|
: List Bool → Bool
|
||||||
|
= λ(xs : List Bool) →
|
||||||
|
List/fold Bool xs Bool (λ(l : Bool) → λ(r : Bool) → l && r) True
|
||||||
|
|
||||||
|
let example0 = assert : and [ True, False, True ] ≡ False
|
||||||
|
|
||||||
|
let example1 = assert : and ([] : List Bool) ≡ True
|
||||||
|
|
||||||
|
in and
|
3
dhall/Prelude/Bool/build
Normal file
3
dhall/Prelude/Bool/build
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:add7cb9acacac705410088d876a7e4488e046a7aded304f06c51accffd7f1b7b
|
||||||
|
? ./build.dhall
|
16
dhall/Prelude/Bool/build.dhall
Normal file
16
dhall/Prelude/Bool/build.dhall
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
--| `build` is the inverse of `fold`
|
||||||
|
let build
|
||||||
|
: (∀(bool : Type) → ∀(true : bool) → ∀(false : bool) → bool) → Bool
|
||||||
|
= λ(f : ∀(bool : Type) → ∀(true : bool) → ∀(false : bool) → bool) →
|
||||||
|
f Bool True False
|
||||||
|
|
||||||
|
let example0 =
|
||||||
|
assert
|
||||||
|
: build (λ(bool : Type) → λ(true : bool) → λ(false : bool) → true) ≡ True
|
||||||
|
|
||||||
|
let example1 =
|
||||||
|
assert
|
||||||
|
: build (λ(bool : Type) → λ(true : bool) → λ(false : bool) → false)
|
||||||
|
≡ False
|
||||||
|
|
||||||
|
in build
|
3
dhall/Prelude/Bool/equal
Normal file
3
dhall/Prelude/Bool/equal
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:f0dc047ca14644c2a979bb126f2a3c6659ec770c66bd7beb70ae4a9d05815709
|
||||||
|
? ./equal.dhall
|
6
dhall/Prelude/Bool/equal.dhall
Normal file
6
dhall/Prelude/Bool/equal.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
--| Returns `True` if both arguments are equal and returns `False` otherwise
|
||||||
|
let equal
|
||||||
|
: Bool -> Bool -> Bool
|
||||||
|
= \(x : Bool) -> \(y : Bool) -> x == y
|
||||||
|
|
||||||
|
in equal
|
3
dhall/Prelude/Bool/even
Normal file
3
dhall/Prelude/Bool/even
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:72a05ee550636a3acb768360fa51ba0db0326763e0cf1ceb737f0f3607fc0fe5
|
||||||
|
? ./even.dhall
|
20
dhall/Prelude/Bool/even.dhall
Normal file
20
dhall/Prelude/Bool/even.dhall
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{-|
|
||||||
|
Returns `True` if there are an even number of `False` elements in the list and
|
||||||
|
returns `False` otherwise.
|
||||||
|
|
||||||
|
This function is the `Monoid` for the `==` operation.
|
||||||
|
-}
|
||||||
|
let even
|
||||||
|
: List Bool → Bool
|
||||||
|
= λ(xs : List Bool) →
|
||||||
|
List/fold Bool xs Bool (λ(x : Bool) → λ(y : Bool) → x == y) True
|
||||||
|
|
||||||
|
let example0 = assert : even [ False, True, False ] ≡ True
|
||||||
|
|
||||||
|
let example1 = assert : even [ False, True ] ≡ False
|
||||||
|
|
||||||
|
let example2 = assert : even [ False ] ≡ False
|
||||||
|
|
||||||
|
let example3 = assert : even ([] : List Bool) ≡ True
|
||||||
|
|
||||||
|
in even
|
3
dhall/Prelude/Bool/fold
Normal file
3
dhall/Prelude/Bool/fold
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:39f60baf3950268c2e849e91dc6279ee41cd6b81892d54020d4fcd2ce30a96ae
|
||||||
|
? ./fold.dhall
|
14
dhall/Prelude/Bool/fold.dhall
Normal file
14
dhall/Prelude/Bool/fold.dhall
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
--| `fold` is essentially the same as `if`/`then`/`else` except as a function
|
||||||
|
let fold
|
||||||
|
: ∀(b : Bool) → ∀(bool : Type) → ∀(true : bool) → ∀(false : bool) → bool
|
||||||
|
= λ(b : Bool) →
|
||||||
|
λ(bool : Type) →
|
||||||
|
λ(true : bool) →
|
||||||
|
λ(false : bool) →
|
||||||
|
if b then true else false
|
||||||
|
|
||||||
|
let example0 = assert : fold True Natural 0 1 ≡ 0
|
||||||
|
|
||||||
|
let example1 = assert : fold False Natural 0 1 ≡ 1
|
||||||
|
|
||||||
|
in fold
|
3
dhall/Prelude/Bool/not
Normal file
3
dhall/Prelude/Bool/not
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:723df402df24377d8a853afed08d9d69a0a6d86e2e5b2bac8960b0d4756c7dc4
|
||||||
|
? ./not.dhall
|
10
dhall/Prelude/Bool/not.dhall
Normal file
10
dhall/Prelude/Bool/not.dhall
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--| Flip the value of a `Bool`
|
||||||
|
let not
|
||||||
|
: Bool → Bool
|
||||||
|
= λ(b : Bool) → b == False
|
||||||
|
|
||||||
|
let example0 = assert : not True ≡ False
|
||||||
|
|
||||||
|
let example1 = assert : not False ≡ True
|
||||||
|
|
||||||
|
in not
|
3
dhall/Prelude/Bool/odd
Normal file
3
dhall/Prelude/Bool/odd
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:6360fca3a745de32bd186cc7b71487a6398cd47d5119064eae491872c41d1999
|
||||||
|
? ./odd.dhall
|
20
dhall/Prelude/Bool/odd.dhall
Normal file
20
dhall/Prelude/Bool/odd.dhall
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{-|
|
||||||
|
Returns `True` if there are an odd number of `True` elements in the list and
|
||||||
|
returns `False` otherwise.
|
||||||
|
|
||||||
|
This function is the `Monoid` for the `!=` operation.
|
||||||
|
-}
|
||||||
|
let odd
|
||||||
|
: List Bool → Bool
|
||||||
|
= λ(xs : List Bool) →
|
||||||
|
List/fold Bool xs Bool (λ(x : Bool) → λ(y : Bool) → x != y) False
|
||||||
|
|
||||||
|
let example0 = assert : odd [ True, False, True ] ≡ False
|
||||||
|
|
||||||
|
let example1 = assert : odd [ True, False ] ≡ True
|
||||||
|
|
||||||
|
let example2 = assert : odd [ True ] ≡ True
|
||||||
|
|
||||||
|
let example3 = assert : odd ([] : List Bool) ≡ False
|
||||||
|
|
||||||
|
in odd
|
3
dhall/Prelude/Bool/or
Normal file
3
dhall/Prelude/Bool/or
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:5c50738e84e1c4fed8343ebd57608500e1b61ac1f502aa52d6d6edb5c20b99e4
|
||||||
|
? ./or.dhall
|
14
dhall/Prelude/Bool/or.dhall
Normal file
14
dhall/Prelude/Bool/or.dhall
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{-|
|
||||||
|
The `or` function returns `True` if there are any `True` elements in the `List`
|
||||||
|
and returns `False` otherwise
|
||||||
|
-}
|
||||||
|
let or
|
||||||
|
: List Bool → Bool
|
||||||
|
= λ(xs : List Bool) →
|
||||||
|
List/fold Bool xs Bool (λ(l : Bool) → λ(r : Bool) → l || r) False
|
||||||
|
|
||||||
|
let example0 = assert : or [ True, False, True ] ≡ True
|
||||||
|
|
||||||
|
let example1 = assert : or ([] : List Bool) ≡ False
|
||||||
|
|
||||||
|
in or
|
37
dhall/Prelude/Bool/package.dhall
Normal file
37
dhall/Prelude/Bool/package.dhall
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{ and =
|
||||||
|
missing
|
||||||
|
sha256:0b2114fa33cd76652e4360f012bc082718944fe4c5b28c975483178f8d9b0a6d
|
||||||
|
? ./and.dhall
|
||||||
|
, build =
|
||||||
|
missing
|
||||||
|
sha256:add7cb9acacac705410088d876a7e4488e046a7aded304f06c51accffd7f1b7b
|
||||||
|
? ./build.dhall
|
||||||
|
, equal =
|
||||||
|
missing
|
||||||
|
sha256:f0dc047ca14644c2a979bb126f2a3c6659ec770c66bd7beb70ae4a9d05815709
|
||||||
|
? ./equal.dhall
|
||||||
|
, even =
|
||||||
|
missing
|
||||||
|
sha256:72a05ee550636a3acb768360fa51ba0db0326763e0cf1ceb737f0f3607fc0fe5
|
||||||
|
? ./even.dhall
|
||||||
|
, fold =
|
||||||
|
missing
|
||||||
|
sha256:39f60baf3950268c2e849e91dc6279ee41cd6b81892d54020d4fcd2ce30a96ae
|
||||||
|
? ./fold.dhall
|
||||||
|
, not =
|
||||||
|
missing
|
||||||
|
sha256:723df402df24377d8a853afed08d9d69a0a6d86e2e5b2bac8960b0d4756c7dc4
|
||||||
|
? ./not.dhall
|
||||||
|
, odd =
|
||||||
|
missing
|
||||||
|
sha256:6360fca3a745de32bd186cc7b71487a6398cd47d5119064eae491872c41d1999
|
||||||
|
? ./odd.dhall
|
||||||
|
, or =
|
||||||
|
missing
|
||||||
|
sha256:5c50738e84e1c4fed8343ebd57608500e1b61ac1f502aa52d6d6edb5c20b99e4
|
||||||
|
? ./or.dhall
|
||||||
|
, show =
|
||||||
|
missing
|
||||||
|
sha256:f85f6d2d921c37a2122cb2e2f8a0170e305b699debd0e6df5ef3370d806b5f61
|
||||||
|
? ./show.dhall
|
||||||
|
}
|
3
dhall/Prelude/Bool/show
Normal file
3
dhall/Prelude/Bool/show
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:f85f6d2d921c37a2122cb2e2f8a0170e305b699debd0e6df5ef3370d806b5f61
|
||||||
|
? ./show.dhall
|
13
dhall/Prelude/Bool/show.dhall
Normal file
13
dhall/Prelude/Bool/show.dhall
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{-|
|
||||||
|
Render a `Bool` as `Text` using the same representation as Dhall source code
|
||||||
|
(i.e. beginning with a capital letter)
|
||||||
|
-}
|
||||||
|
let show
|
||||||
|
: Bool → Text
|
||||||
|
= λ(b : Bool) → if b then "True" else "False"
|
||||||
|
|
||||||
|
let example0 = assert : show True ≡ "True"
|
||||||
|
|
||||||
|
let example1 = assert : show False ≡ "False"
|
||||||
|
|
||||||
|
in show
|
5
dhall/Prelude/Date/package.dhall
Normal file
5
dhall/Prelude/Date/package.dhall
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{ show =
|
||||||
|
missing
|
||||||
|
sha256:8a0eb9732cbc3c8f161b7cb05b183493befacc4728d2d9b7ee1384f19106a5ff
|
||||||
|
? ./show.dhall
|
||||||
|
}
|
15
dhall/Prelude/Date/show.dhall
Normal file
15
dhall/Prelude/Date/show.dhall
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{-
|
||||||
|
Render a `Date` as `Text` using the same representation as Dhall source code
|
||||||
|
(i.e. `YYYY-MM-DD`)
|
||||||
|
-}
|
||||||
|
let show
|
||||||
|
: Date → Text
|
||||||
|
= Date/show
|
||||||
|
|
||||||
|
let example0 = assert : show 2000-09-02 ≡ "2000-09-02"
|
||||||
|
|
||||||
|
let example1 = assert : show 9999-12-31 ≡ "9999-12-31"
|
||||||
|
|
||||||
|
let example2 = assert : show 0000-01-01 ≡ "0000-01-01"
|
||||||
|
|
||||||
|
in show
|
5
dhall/Prelude/DirectoryTree/Access/Mask/Type.dhall
Normal file
5
dhall/Prelude/DirectoryTree/Access/Mask/Type.dhall
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{-|
|
||||||
|
A (total) set of access rights; See chmod(5) for an explanation of the flags.
|
||||||
|
For a partial set of of access rights see `Access`.
|
||||||
|
-}
|
||||||
|
{ execute : Bool, read : Bool, write : Bool }
|
69
dhall/Prelude/DirectoryTree/Access/Mask/intersect.dhall
Normal file
69
dhall/Prelude/DirectoryTree/Access/Mask/intersect.dhall
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
{-|
|
||||||
|
@intersect a b@ intesects the flags of the two `Mask`s @a@ and @b@. This
|
||||||
|
resembles the bitwise "and", i.e. the value of a flag is 'True' if and only if
|
||||||
|
it is set to 'True' in both @a@ and @b@. As a consequence @intersect a rwx == a@
|
||||||
|
and @intersect a none == none@ for all @a@.
|
||||||
|
-}
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let intersect
|
||||||
|
: Mask -> Mask -> Mask
|
||||||
|
= \(m1 : Mask) ->
|
||||||
|
\(m2 : Mask) ->
|
||||||
|
{ read = m1.read && m2.read
|
||||||
|
, write = m1.write && m2.write
|
||||||
|
, execute = m1.execute && m2.execute
|
||||||
|
}
|
||||||
|
|
||||||
|
let example0 =
|
||||||
|
let r =
|
||||||
|
missing
|
||||||
|
sha256:26d7fc8df6194a8051946eac88d0d7fecce690bff6819e69b3c74edf65ac027a
|
||||||
|
? ./r.dhall
|
||||||
|
|
||||||
|
let w =
|
||||||
|
missing
|
||||||
|
sha256:9d10dfc672f61bbb2828c7be2121aae2502938c25adb47bb8cce3c40ba99821b
|
||||||
|
? ./w.dhall
|
||||||
|
|
||||||
|
let x =
|
||||||
|
missing
|
||||||
|
sha256:a966fd88c05a5912a6daa8409e0c9e396f0a4810b51def1e1f62a95e18235f10
|
||||||
|
? ./x.dhall
|
||||||
|
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ./rwx.dhall
|
||||||
|
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ./none.dhall
|
||||||
|
|
||||||
|
in assert : intersect r (intersect w (intersect x rwx)) === none
|
||||||
|
|
||||||
|
let example1 =
|
||||||
|
\(a : Mask) ->
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ./rwx.dhall
|
||||||
|
|
||||||
|
in assert
|
||||||
|
: intersect a rwx
|
||||||
|
=== { execute = a.execute, read = a.read, write = a.write }
|
||||||
|
|
||||||
|
let example2 =
|
||||||
|
\(a : Mask) ->
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ./none.dhall
|
||||||
|
|
||||||
|
in assert : intersect a none === none
|
||||||
|
|
||||||
|
in intersect
|
48
dhall/Prelude/DirectoryTree/Access/Mask/invert.dhall
Normal file
48
dhall/Prelude/DirectoryTree/Access/Mask/invert.dhall
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{-|
|
||||||
|
Inverts the flags set in a `Mask`.
|
||||||
|
-}
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let Bool/not =
|
||||||
|
missing
|
||||||
|
sha256:723df402df24377d8a853afed08d9d69a0a6d86e2e5b2bac8960b0d4756c7dc4
|
||||||
|
? ../../../Bool/not.dhall
|
||||||
|
|
||||||
|
let invert
|
||||||
|
: Mask -> Mask
|
||||||
|
= \(m : Mask) ->
|
||||||
|
{ read = Bool/not m.read
|
||||||
|
, write = Bool/not m.write
|
||||||
|
, execute = Bool/not m.execute
|
||||||
|
}
|
||||||
|
|
||||||
|
let example0 =
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ./none.dhall
|
||||||
|
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ./rwx.dhall
|
||||||
|
|
||||||
|
in assert : invert rwx === none
|
||||||
|
|
||||||
|
let example1 =
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ./none.dhall
|
||||||
|
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ./rwx.dhall
|
||||||
|
|
||||||
|
in assert : invert none === rwx
|
||||||
|
|
||||||
|
in invert
|
4
dhall/Prelude/DirectoryTree/Access/Mask/none.dhall
Normal file
4
dhall/Prelude/DirectoryTree/Access/Mask/none.dhall
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ read = False, write = False, execute = False }
|
||||||
|
: missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
53
dhall/Prelude/DirectoryTree/Access/Mask/package.dhall
Normal file
53
dhall/Prelude/DirectoryTree/Access/Mask/package.dhall
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
{ Type =
|
||||||
|
missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
||||||
|
, intersect =
|
||||||
|
missing
|
||||||
|
sha256:7c7dab3e305f43cba556e0778b5a797cf8e9b1d1a6c6f6fe0ea311c329919663
|
||||||
|
? ./intersect.dhall
|
||||||
|
, invert =
|
||||||
|
missing
|
||||||
|
sha256:8807fb02f694fe2117f8a7f794e5afbb967ec36eac3405184bf9232c33cdd830
|
||||||
|
? ./invert.dhall
|
||||||
|
, none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ./none.dhall
|
||||||
|
, r =
|
||||||
|
missing
|
||||||
|
sha256:26d7fc8df6194a8051946eac88d0d7fecce690bff6819e69b3c74edf65ac027a
|
||||||
|
? ./r.dhall
|
||||||
|
, rw =
|
||||||
|
missing
|
||||||
|
sha256:c3cce19f462b841e64adafbdf2963699a0031f5fc08b041c8ad364483c544d8b
|
||||||
|
? ./rw.dhall
|
||||||
|
, rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ./rwx.dhall
|
||||||
|
, rx =
|
||||||
|
missing
|
||||||
|
sha256:d9beaa853c0de6984c3e5b0e313b573942900f8024fd9aaad743d73df458dc5e
|
||||||
|
? ./rx.dhall
|
||||||
|
, toAccess =
|
||||||
|
missing
|
||||||
|
sha256:78fe016f0273b2551c8590da71bf204cc26d6879c6b84622d4d8ad5624328438
|
||||||
|
? ./toAccess.dhall
|
||||||
|
, toAccessWith =
|
||||||
|
missing
|
||||||
|
sha256:814ab74ad292c121620a1f468837d4a5473323423bf68c1bceca69e7b3c59077
|
||||||
|
? ./toAccessWith.dhall
|
||||||
|
, union =
|
||||||
|
missing
|
||||||
|
sha256:b40c4cbb266991e3f764af075e9db544b59c16b3d9aa680c0cf6cb7552da191f
|
||||||
|
? ./union.dhall
|
||||||
|
, w =
|
||||||
|
missing
|
||||||
|
sha256:9d10dfc672f61bbb2828c7be2121aae2502938c25adb47bb8cce3c40ba99821b
|
||||||
|
? ./w.dhall
|
||||||
|
, x =
|
||||||
|
missing
|
||||||
|
sha256:a966fd88c05a5912a6daa8409e0c9e396f0a4810b51def1e1f62a95e18235f10
|
||||||
|
? ./x.dhall
|
||||||
|
}
|
4
dhall/Prelude/DirectoryTree/Access/Mask/r.dhall
Normal file
4
dhall/Prelude/DirectoryTree/Access/Mask/r.dhall
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ read = True, write = False, execute = False }
|
||||||
|
: missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
4
dhall/Prelude/DirectoryTree/Access/Mask/rw.dhall
Normal file
4
dhall/Prelude/DirectoryTree/Access/Mask/rw.dhall
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ read = True, write = True, execute = False }
|
||||||
|
: missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
4
dhall/Prelude/DirectoryTree/Access/Mask/rwx.dhall
Normal file
4
dhall/Prelude/DirectoryTree/Access/Mask/rwx.dhall
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ read = True, write = True, execute = True }
|
||||||
|
: missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
4
dhall/Prelude/DirectoryTree/Access/Mask/rx.dhall
Normal file
4
dhall/Prelude/DirectoryTree/Access/Mask/rx.dhall
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ read = True, write = False, execute = True }
|
||||||
|
: missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
20
dhall/Prelude/DirectoryTree/Access/Mask/toAccess.dhall
Normal file
20
dhall/Prelude/DirectoryTree/Access/Mask/toAccess.dhall
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{-|
|
||||||
|
Convert a `Mask` value to an `Access` value. For a partial conversion see
|
||||||
|
`toAccessWith`.
|
||||||
|
-}
|
||||||
|
let Access =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ../Type.dhall
|
||||||
|
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let toAccess
|
||||||
|
: Mask -> Access
|
||||||
|
= \(m : Mask) ->
|
||||||
|
{ execute = Some m.execute, read = Some m.read, write = Some m.write }
|
||||||
|
|
||||||
|
in toAccess
|
42
dhall/Prelude/DirectoryTree/Access/Mask/toAccessWith.dhall
Normal file
42
dhall/Prelude/DirectoryTree/Access/Mask/toAccessWith.dhall
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{-|
|
||||||
|
@toAccessWith x m@ converts some fields of a `Mask` @m@ to an `Access` setting:
|
||||||
|
If the respective field is set in the first `Mask` @x@, then the flag will be
|
||||||
|
set to the flags value given in @m@. Otherwise, the value set in @m@ is ignored
|
||||||
|
and the value of the flag in the result is `None`.
|
||||||
|
|
||||||
|
For a motivation of this function see the documenation on `toModeWith`.
|
||||||
|
-}
|
||||||
|
let Access =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ../Type.dhall
|
||||||
|
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let toAccessWith
|
||||||
|
: Mask -> Mask -> Access
|
||||||
|
= \(set : Mask) ->
|
||||||
|
\(m : Mask) ->
|
||||||
|
{ execute = if set.execute then Some m.execute else None Bool
|
||||||
|
, read = if set.read then Some m.read else None Bool
|
||||||
|
, write = if set.write then Some m.write else None Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
let example0 =
|
||||||
|
\(a : Mask) ->
|
||||||
|
let Access/none =
|
||||||
|
missing
|
||||||
|
sha256:955a2eed689139c811d4b9ef3dd8d0c484392b18c3bb8752c59fd69dbdaf4881
|
||||||
|
? ../none.dhall
|
||||||
|
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ./none.dhall
|
||||||
|
|
||||||
|
in assert : toAccessWith none a === Access/none
|
||||||
|
|
||||||
|
in toAccessWith
|
64
dhall/Prelude/DirectoryTree/Access/Mask/union.dhall
Normal file
64
dhall/Prelude/DirectoryTree/Access/Mask/union.dhall
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{-|
|
||||||
|
@union a b@ combines the flags of the two `Mask`s @a@ and @b@. This resembles
|
||||||
|
the bitwise "or", i.e. the value of a flag is 'True' if it is set to 'True' in
|
||||||
|
either @a@ and @b@. As a consequence @union a rwx == rwx@ and
|
||||||
|
@union a none == a@ for all @a@.
|
||||||
|
-}
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let union
|
||||||
|
: Mask -> Mask -> Mask
|
||||||
|
= \(m1 : Mask) ->
|
||||||
|
\(m2 : Mask) ->
|
||||||
|
{ read = m1.read || m2.read
|
||||||
|
, write = m1.write || m2.write
|
||||||
|
, execute = m1.execute || m2.execute
|
||||||
|
}
|
||||||
|
|
||||||
|
let example0 =
|
||||||
|
let r =
|
||||||
|
missing
|
||||||
|
sha256:26d7fc8df6194a8051946eac88d0d7fecce690bff6819e69b3c74edf65ac027a
|
||||||
|
? ./r.dhall
|
||||||
|
|
||||||
|
let w =
|
||||||
|
missing
|
||||||
|
sha256:9d10dfc672f61bbb2828c7be2121aae2502938c25adb47bb8cce3c40ba99821b
|
||||||
|
? ./w.dhall
|
||||||
|
|
||||||
|
let x =
|
||||||
|
missing
|
||||||
|
sha256:a966fd88c05a5912a6daa8409e0c9e396f0a4810b51def1e1f62a95e18235f10
|
||||||
|
? ./x.dhall
|
||||||
|
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ./rwx.dhall
|
||||||
|
|
||||||
|
in assert : union r (union w x) === rwx
|
||||||
|
|
||||||
|
let example1 =
|
||||||
|
\(a : Mask) ->
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ./rwx.dhall
|
||||||
|
|
||||||
|
in assert : union a rwx === rwx
|
||||||
|
|
||||||
|
let example1 =
|
||||||
|
\(a : Mask) ->
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ./none.dhall
|
||||||
|
|
||||||
|
in assert
|
||||||
|
: union a none
|
||||||
|
=== { execute = a.execute, read = a.read, write = a.write }
|
||||||
|
|
||||||
|
in union
|
4
dhall/Prelude/DirectoryTree/Access/Mask/w.dhall
Normal file
4
dhall/Prelude/DirectoryTree/Access/Mask/w.dhall
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ read = False, write = True, execute = False }
|
||||||
|
: missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
4
dhall/Prelude/DirectoryTree/Access/Mask/x.dhall
Normal file
4
dhall/Prelude/DirectoryTree/Access/Mask/x.dhall
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ read = False, write = False, execute = True }
|
||||||
|
: missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ./Type.dhall
|
5
dhall/Prelude/DirectoryTree/Access/Type.dhall
Normal file
5
dhall/Prelude/DirectoryTree/Access/Type.dhall
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{-|
|
||||||
|
A (partial) set of access rights; See chmod(5) for an explanation of the flags.
|
||||||
|
For a total set of access rights see `Mask`.
|
||||||
|
-}
|
||||||
|
{ execute : Optional Bool, read : Optional Bool, write : Optional Bool }
|
29
dhall/Prelude/DirectoryTree/Access/equal.dhall
Normal file
29
dhall/Prelude/DirectoryTree/Access/equal.dhall
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{-|
|
||||||
|
`equal` checks if two `Access` settings are equal.
|
||||||
|
-}
|
||||||
|
let Access =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let Bool/equal =
|
||||||
|
missing
|
||||||
|
sha256:f0dc047ca14644c2a979bb126f2a3c6659ec770c66bd7beb70ae4a9d05815709
|
||||||
|
? ../../Bool/equal.dhall
|
||||||
|
|
||||||
|
let Optional/equal =
|
||||||
|
missing
|
||||||
|
sha256:5411888399fe9c6720f7f3b59caf5eff3e8e8c30402d09f34e46a4457649a35a
|
||||||
|
? ../../Optional/equal.dhall
|
||||||
|
|
||||||
|
let f
|
||||||
|
: Optional Bool -> Optional Bool -> Bool
|
||||||
|
= Optional/equal Bool Bool/equal
|
||||||
|
|
||||||
|
let equal
|
||||||
|
: Access -> Access -> Bool
|
||||||
|
= \(a1 : Access) ->
|
||||||
|
\(a2 : Access) ->
|
||||||
|
f a1.execute a2.execute && f a1.read a2.read && f a1.write a2.write
|
||||||
|
|
||||||
|
in equal
|
4
dhall/Prelude/DirectoryTree/Access/none.dhall
Normal file
4
dhall/Prelude/DirectoryTree/Access/none.dhall
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ read = None Bool, write = None Bool, execute = None Bool }
|
||||||
|
: missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ./Type.dhall
|
17
dhall/Prelude/DirectoryTree/Access/package.dhall
Normal file
17
dhall/Prelude/DirectoryTree/Access/package.dhall
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ Mask =
|
||||||
|
missing
|
||||||
|
sha256:ed736de51ea15a2ef671eaa7219dfbf3138bb52acfd0ae17894acf2ec4b06369
|
||||||
|
? ./Mask/package.dhall
|
||||||
|
, Type =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ./Type.dhall
|
||||||
|
, equal =
|
||||||
|
missing
|
||||||
|
sha256:5fa90f55505780a7be942275d6bbb2b1f1fb7857364332ed732a0241c2165e53
|
||||||
|
? ./equal.dhall
|
||||||
|
, schema =
|
||||||
|
missing
|
||||||
|
sha256:7d33a584a42a5d92411d5ca623e27ccb397762905be86ecfd01b106719fae690
|
||||||
|
? ./schema.dhall
|
||||||
|
}
|
12
dhall/Prelude/DirectoryTree/Access/schema.dhall
Normal file
12
dhall/Prelude/DirectoryTree/Access/schema.dhall
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{-|
|
||||||
|
A schema for blank access rights.
|
||||||
|
-}
|
||||||
|
{ Type =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ./Type.dhall
|
||||||
|
, default =
|
||||||
|
missing
|
||||||
|
sha256:955a2eed689139c811d4b9ef3dd8d0c484392b18c3bb8752c59fd69dbdaf4881
|
||||||
|
? ./none.dhall
|
||||||
|
}
|
6
dhall/Prelude/DirectoryTree/Entry/DirectoryEntry.dhall
Normal file
6
dhall/Prelude/DirectoryTree/Entry/DirectoryEntry.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let Entry =
|
||||||
|
missing
|
||||||
|
sha256:75148ae19175750e38705e11cda8dcc775b2ac08f22518ff2ef3f33a6273ef15
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
in \(tree : Type) -> Entry (List tree)
|
6
dhall/Prelude/DirectoryTree/Entry/FileEntry.dhall
Normal file
6
dhall/Prelude/DirectoryTree/Entry/FileEntry.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let Entry =
|
||||||
|
missing
|
||||||
|
sha256:75148ae19175750e38705e11cda8dcc775b2ac08f22518ff2ef3f33a6273ef15
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
in Entry Text
|
24
dhall/Prelude/DirectoryTree/Entry/Metadata.dhall
Normal file
24
dhall/Prelude/DirectoryTree/Entry/Metadata.dhall
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{-|
|
||||||
|
An `Entry` without content. That in turn implies that the type of the entry
|
||||||
|
(i.e. whether it is a file or a directory) is not (yet) fixed as well.
|
||||||
|
-}
|
||||||
|
let User =
|
||||||
|
missing
|
||||||
|
sha256:8b25916612d2c9b17130d16b55c6bdb085dd118e692f72bf351a83b1d0ac8833
|
||||||
|
? ../User/Type.dhall
|
||||||
|
|
||||||
|
let Group =
|
||||||
|
missing
|
||||||
|
sha256:83e6e8846153d94abf6f879808c94f5cdba3f486cc9e392eb6124b1dc67368cf
|
||||||
|
? ../Group/Type.dhall
|
||||||
|
|
||||||
|
let Mode =
|
||||||
|
missing
|
||||||
|
sha256:f05819ec2145e7dabf4aa167338bee6d326aabd81355dcf0b078e358bd34ec60
|
||||||
|
? ../Mode/Type.dhall
|
||||||
|
|
||||||
|
in { name : Text
|
||||||
|
, user : Optional User
|
||||||
|
, group : Optional Group
|
||||||
|
, mode : Optional Mode
|
||||||
|
}
|
6
dhall/Prelude/DirectoryTree/Entry/Type.dhall
Normal file
6
dhall/Prelude/DirectoryTree/Entry/Type.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let Metadata =
|
||||||
|
missing
|
||||||
|
sha256:8c240a00094238a73904af63ac0924b3e6aba1655312f20a2a27f88554e2febe
|
||||||
|
? ./Metadata.dhall
|
||||||
|
|
||||||
|
in \(content : Type) -> Metadata //\\ { content : content }
|
6
dhall/Prelude/DirectoryTree/Entry/directory.dhall
Normal file
6
dhall/Prelude/DirectoryTree/Entry/directory.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let Entry =
|
||||||
|
missing
|
||||||
|
sha256:742610b2a13e55ae6e344b54aa8a7ee1bfec8e8b313a1132eae9286309b520e6
|
||||||
|
? ./entry.dhall
|
||||||
|
|
||||||
|
in \(tree : Type) -> Entry (List tree)
|
24
dhall/Prelude/DirectoryTree/Entry/entry.dhall
Normal file
24
dhall/Prelude/DirectoryTree/Entry/entry.dhall
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
let Entry =
|
||||||
|
missing
|
||||||
|
sha256:75148ae19175750e38705e11cda8dcc775b2ac08f22518ff2ef3f33a6273ef15
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let User =
|
||||||
|
missing
|
||||||
|
sha256:8b25916612d2c9b17130d16b55c6bdb085dd118e692f72bf351a83b1d0ac8833
|
||||||
|
? ../User/Type.dhall
|
||||||
|
|
||||||
|
let Group =
|
||||||
|
missing
|
||||||
|
sha256:83e6e8846153d94abf6f879808c94f5cdba3f486cc9e392eb6124b1dc67368cf
|
||||||
|
? ../Group/Type.dhall
|
||||||
|
|
||||||
|
let Mode =
|
||||||
|
missing
|
||||||
|
sha256:f05819ec2145e7dabf4aa167338bee6d326aabd81355dcf0b078e358bd34ec60
|
||||||
|
? ../Mode/Type.dhall
|
||||||
|
|
||||||
|
in \(content : Type) ->
|
||||||
|
{ Type = Entry content
|
||||||
|
, default = { user = None User, group = None Group, mode = None Mode }
|
||||||
|
}
|
6
dhall/Prelude/DirectoryTree/Entry/file.dhall
Normal file
6
dhall/Prelude/DirectoryTree/Entry/file.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let Entry =
|
||||||
|
missing
|
||||||
|
sha256:742610b2a13e55ae6e344b54aa8a7ee1bfec8e8b313a1132eae9286309b520e6
|
||||||
|
? ./entry.dhall
|
||||||
|
|
||||||
|
in Entry Text
|
29
dhall/Prelude/DirectoryTree/Entry/package.dhall
Normal file
29
dhall/Prelude/DirectoryTree/Entry/package.dhall
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{ Directory =
|
||||||
|
missing
|
||||||
|
sha256:163a4536fdd05ce122d793ceda01d03fcffb29463817ae8b7b5601bf4a06ce6e
|
||||||
|
? ./DirectoryEntry.dhall
|
||||||
|
, File =
|
||||||
|
missing
|
||||||
|
sha256:23a8cb29d96aeb623501519d9a62c5c49659e8d1c30b4ae4f2399809e3fd3a01
|
||||||
|
? ./FileEntry.dhall
|
||||||
|
, Metadata =
|
||||||
|
missing
|
||||||
|
sha256:8c240a00094238a73904af63ac0924b3e6aba1655312f20a2a27f88554e2febe
|
||||||
|
? ./Metadata.dhall
|
||||||
|
, Type =
|
||||||
|
missing
|
||||||
|
sha256:75148ae19175750e38705e11cda8dcc775b2ac08f22518ff2ef3f33a6273ef15
|
||||||
|
? ./Type.dhall
|
||||||
|
, directory =
|
||||||
|
missing
|
||||||
|
sha256:0bee17310a21efa5b06f139b6731fdcee4f9e0245ef711c2b0127b8938dfed2e
|
||||||
|
? ./directory.dhall
|
||||||
|
, entry =
|
||||||
|
missing
|
||||||
|
sha256:742610b2a13e55ae6e344b54aa8a7ee1bfec8e8b313a1132eae9286309b520e6
|
||||||
|
? ./entry.dhall
|
||||||
|
, file =
|
||||||
|
missing
|
||||||
|
sha256:c5d76fd43216668d03df9945183fe7b3c55486aedcc77324c3372bd63e283b78
|
||||||
|
? ./file.dhall
|
||||||
|
}
|
1
dhall/Prelude/DirectoryTree/Group/Type.dhall
Normal file
1
dhall/Prelude/DirectoryTree/Group/Type.dhall
Normal file
|
@ -0,0 +1 @@
|
||||||
|
< GroupId : Natural | GroupName : Text >
|
6
dhall/Prelude/DirectoryTree/Group/id.dhall
Normal file
6
dhall/Prelude/DirectoryTree/Group/id.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let Group =
|
||||||
|
missing
|
||||||
|
sha256:83e6e8846153d94abf6f879808c94f5cdba3f486cc9e392eb6124b1dc67368cf
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
in Group.GroupId
|
6
dhall/Prelude/DirectoryTree/Group/name.dhall
Normal file
6
dhall/Prelude/DirectoryTree/Group/name.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let Group =
|
||||||
|
missing
|
||||||
|
sha256:83e6e8846153d94abf6f879808c94f5cdba3f486cc9e392eb6124b1dc67368cf
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
in Group.GroupName
|
13
dhall/Prelude/DirectoryTree/Group/package.dhall
Normal file
13
dhall/Prelude/DirectoryTree/Group/package.dhall
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{ Type =
|
||||||
|
missing
|
||||||
|
sha256:83e6e8846153d94abf6f879808c94f5cdba3f486cc9e392eb6124b1dc67368cf
|
||||||
|
? ./Type.dhall
|
||||||
|
, id =
|
||||||
|
missing
|
||||||
|
sha256:2bf9e546f56a583243d419a652caba16ca4053df9ccb3c5b242506d86806944b
|
||||||
|
? ./id.dhall
|
||||||
|
, name =
|
||||||
|
missing
|
||||||
|
sha256:51ac5c407f2939ab0c80bf2896d292ee6049bd8ba10acda0af327a3777f2205d
|
||||||
|
? ./name.dhall
|
||||||
|
}
|
10
dhall/Prelude/DirectoryTree/Mode/Mask/Type.dhall
Normal file
10
dhall/Prelude/DirectoryTree/Mode/Mask/Type.dhall
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{-|
|
||||||
|
A complete mode with all access rights specified explicitely. For an incomplete
|
||||||
|
mode where some access rights might not be set see `Mode`.
|
||||||
|
-}
|
||||||
|
let Access/Mask =
|
||||||
|
missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ../../Access/Mask/Type.dhall
|
||||||
|
|
||||||
|
in { user : Access/Mask, group : Access/Mask, other : Access/Mask }
|
9
dhall/Prelude/DirectoryTree/Mode/Mask/all.dhall
Normal file
9
dhall/Prelude/DirectoryTree/Mode/Mask/all.dhall
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{-|
|
||||||
|
Permissions with all flags set: rwxrwxrwx
|
||||||
|
-}
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ../../Access/Mask/rwx.dhall
|
||||||
|
|
||||||
|
in { user = rwx, group = rwx, other = rwx }
|
17
dhall/Prelude/DirectoryTree/Mode/Mask/directory.dhall
Normal file
17
dhall/Prelude/DirectoryTree/Mode/Mask/directory.dhall
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{-|
|
||||||
|
Permissions commonly used for directories: rwxr-xr-x
|
||||||
|
-}
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ../../Access/Mask/rwx.dhall
|
||||||
|
|
||||||
|
let rx =
|
||||||
|
missing
|
||||||
|
sha256:d9beaa853c0de6984c3e5b0e313b573942900f8024fd9aaad743d73df458dc5e
|
||||||
|
? ../../Access/Mask/rx.dhall
|
||||||
|
|
||||||
|
in { user = rwx, group = rx, other = rx }
|
||||||
|
: missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
17
dhall/Prelude/DirectoryTree/Mode/Mask/executable.dhall
Normal file
17
dhall/Prelude/DirectoryTree/Mode/Mask/executable.dhall
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{-|
|
||||||
|
Permissions commonly used for executable files: rwxr-xr-x
|
||||||
|
-}
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ../../Access/Mask/rwx.dhall
|
||||||
|
|
||||||
|
let rx =
|
||||||
|
missing
|
||||||
|
sha256:d9beaa853c0de6984c3e5b0e313b573942900f8024fd9aaad743d73df458dc5e
|
||||||
|
? ../../Access/Mask/rx.dhall
|
||||||
|
|
||||||
|
in { user = rwx, group = rx, other = rx }
|
||||||
|
: missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
17
dhall/Prelude/DirectoryTree/Mode/Mask/file.dhall
Normal file
17
dhall/Prelude/DirectoryTree/Mode/Mask/file.dhall
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{-|
|
||||||
|
Permissions commonly used for regular files: rw-r--r--
|
||||||
|
-}
|
||||||
|
let r =
|
||||||
|
missing
|
||||||
|
sha256:26d7fc8df6194a8051946eac88d0d7fecce690bff6819e69b3c74edf65ac027a
|
||||||
|
? ../../Access/Mask/r.dhall
|
||||||
|
|
||||||
|
let rw =
|
||||||
|
missing
|
||||||
|
sha256:c3cce19f462b841e64adafbdf2963699a0031f5fc08b041c8ad364483c544d8b
|
||||||
|
? ../../Access/Mask/rw.dhall
|
||||||
|
|
||||||
|
in { user = rw, group = r, other = r }
|
||||||
|
: missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
14
dhall/Prelude/DirectoryTree/Mode/Mask/group.dhall
Normal file
14
dhall/Prelude/DirectoryTree/Mode/Mask/group.dhall
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{-|
|
||||||
|
Permissions with group flags set: ---rwx---
|
||||||
|
-}
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ../../Access/Mask/rwx.dhall
|
||||||
|
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ../../Access/Mask/none.dhall
|
||||||
|
|
||||||
|
in { user = none, group = rwx, other = none }
|
24
dhall/Prelude/DirectoryTree/Mode/Mask/intersect.dhall
Normal file
24
dhall/Prelude/DirectoryTree/Mode/Mask/intersect.dhall
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{-|
|
||||||
|
Calculates the intersection of the access rights of two `Mask`s using
|
||||||
|
`Access/intersect`.
|
||||||
|
-}
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let Access/intersect =
|
||||||
|
missing
|
||||||
|
sha256:7c7dab3e305f43cba556e0778b5a797cf8e9b1d1a6c6f6fe0ea311c329919663
|
||||||
|
? ../../Access/Mask/intersect.dhall
|
||||||
|
|
||||||
|
let intersect
|
||||||
|
: Mask -> Mask -> Mask
|
||||||
|
= \(m1 : Mask) ->
|
||||||
|
\(m2 : Mask) ->
|
||||||
|
{ user = Access/intersect m1.user m2.user
|
||||||
|
, group = Access/intersect m1.group m2.group
|
||||||
|
, other = Access/intersect m1.other m2.other
|
||||||
|
}
|
||||||
|
|
||||||
|
in intersect
|
22
dhall/Prelude/DirectoryTree/Mode/Mask/invert.dhall
Normal file
22
dhall/Prelude/DirectoryTree/Mode/Mask/invert.dhall
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{-|
|
||||||
|
Inverts each access right set in a `Mask` using `Access/invert`.
|
||||||
|
-}
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let Access/invert =
|
||||||
|
missing
|
||||||
|
sha256:8807fb02f694fe2117f8a7f794e5afbb967ec36eac3405184bf9232c33cdd830
|
||||||
|
? ../../Access/Mask/invert.dhall
|
||||||
|
|
||||||
|
let invert
|
||||||
|
: Mask -> Mask
|
||||||
|
= \(m : Mask) ->
|
||||||
|
{ user = Access/invert m.user
|
||||||
|
, group = Access/invert m.group
|
||||||
|
, other = Access/invert m.other
|
||||||
|
}
|
||||||
|
|
||||||
|
in invert
|
12
dhall/Prelude/DirectoryTree/Mode/Mask/none.dhall
Normal file
12
dhall/Prelude/DirectoryTree/Mode/Mask/none.dhall
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{-|
|
||||||
|
Permissions with no flags set: ---------
|
||||||
|
-}
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ../../Access/Mask/none.dhall
|
||||||
|
|
||||||
|
in { user = none, group = none, other = none }
|
||||||
|
: missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
14
dhall/Prelude/DirectoryTree/Mode/Mask/other.dhall
Normal file
14
dhall/Prelude/DirectoryTree/Mode/Mask/other.dhall
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{-|
|
||||||
|
Permissions with other flags set: ------rwx
|
||||||
|
-}
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ../../Access/Mask/rwx.dhall
|
||||||
|
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ../../Access/Mask/none.dhall
|
||||||
|
|
||||||
|
in { user = none, group = none, other = rwx }
|
41
dhall/Prelude/DirectoryTree/Mode/Mask/package.dhall
Normal file
41
dhall/Prelude/DirectoryTree/Mode/Mask/package.dhall
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{ Type =
|
||||||
|
missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
||||||
|
, directory =
|
||||||
|
missing
|
||||||
|
sha256:a43f235f0caa25c7cabd89ac5d77e466e0c0ebf3339046993c18e481930243fd
|
||||||
|
? ./directory.dhall
|
||||||
|
, executable =
|
||||||
|
missing
|
||||||
|
sha256:a43f235f0caa25c7cabd89ac5d77e466e0c0ebf3339046993c18e481930243fd
|
||||||
|
? ./executable.dhall
|
||||||
|
, file =
|
||||||
|
missing
|
||||||
|
sha256:32d34228d48a707996272d1c9681171ddcd6651f72eeb3de9727d1c26ba99df3
|
||||||
|
? ./file.dhall
|
||||||
|
, intersect =
|
||||||
|
missing
|
||||||
|
sha256:146be962523ef619d3a250699f977b69c3e5f6c24b975453f351c0e807266fc8
|
||||||
|
? ./intersect.dhall
|
||||||
|
, invert =
|
||||||
|
missing
|
||||||
|
sha256:07a13d8c233d0a9fd6b3a11475987c10619072fec882c96bc5499bfb3c01e9b2
|
||||||
|
? ./invert.dhall
|
||||||
|
, none =
|
||||||
|
missing
|
||||||
|
sha256:7cac21e2b72cadf3ee0bf10680df4902ca73b6ee070219df5eac1a24cd66ccdf
|
||||||
|
? ./none.dhall
|
||||||
|
, toMode =
|
||||||
|
missing
|
||||||
|
sha256:af2b0dab799374afa0a2f28551446760ff29f4697c200da0a8b0a8def7feee2a
|
||||||
|
? ./toMode.dhall
|
||||||
|
, toModeWith =
|
||||||
|
missing
|
||||||
|
sha256:b92327bec9141cc1a55bc3f11ae2584af0883b94fe2513376fc40f1da5ade9b2
|
||||||
|
? ./toModeWith.dhall
|
||||||
|
, union =
|
||||||
|
missing
|
||||||
|
sha256:3bb32fc6ea21f661571e46d90e450e0340b2f2b65482ba7bd1a30514e1b39fc2
|
||||||
|
? ./union.dhall
|
||||||
|
}
|
28
dhall/Prelude/DirectoryTree/Mode/Mask/toMode.dhall
Normal file
28
dhall/Prelude/DirectoryTree/Mode/Mask/toMode.dhall
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{-|
|
||||||
|
Convert a `Mask` value to a `Mode` value. For a partial conversion see
|
||||||
|
`toModeWith`.
|
||||||
|
-}
|
||||||
|
let Mode =
|
||||||
|
missing
|
||||||
|
sha256:f05819ec2145e7dabf4aa167338bee6d326aabd81355dcf0b078e358bd34ec60
|
||||||
|
? ../Type.dhall
|
||||||
|
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let Access/toAccess =
|
||||||
|
missing
|
||||||
|
sha256:78fe016f0273b2551c8590da71bf204cc26d6879c6b84622d4d8ad5624328438
|
||||||
|
? ../../Access/Mask/toAccess.dhall
|
||||||
|
|
||||||
|
let toMode
|
||||||
|
: Mask -> Mode
|
||||||
|
= \(m : Mask) ->
|
||||||
|
{ user = Some (Access/toAccess m.user)
|
||||||
|
, group = Some (Access/toAccess m.group)
|
||||||
|
, other = Some (Access/toAccess m.other)
|
||||||
|
}
|
||||||
|
|
||||||
|
in toMode
|
149
dhall/Prelude/DirectoryTree/Mode/Mask/toModeWith.dhall
Normal file
149
dhall/Prelude/DirectoryTree/Mode/Mask/toModeWith.dhall
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
{-|
|
||||||
|
@toModeWith x m@ converts some fields of a `Mask` @m@ to a `Mode`: If the
|
||||||
|
respective field is set in the first `Mask` @x@, then the flag will be set to
|
||||||
|
the flags value given in @m@. Otherwise, the value set in @m@ is ignored and the
|
||||||
|
value of the flag in the result is `None`.
|
||||||
|
|
||||||
|
The function is motivated by the following use case:
|
||||||
|
Alice has her umask set to 022 and new files will have permissions set to
|
||||||
|
rw-r--r--. Bob has the umask set to 077, hence newly created files will have
|
||||||
|
rw------- permissions. Now Eve distributes Dhall code writing a file with the
|
||||||
|
following mode to the filesystem:
|
||||||
|
```dhall
|
||||||
|
let mask = ./other.dhall
|
||||||
|
|
||||||
|
let permissions = ./all.dhall
|
||||||
|
|
||||||
|
in
|
||||||
|
toModeWith mask permissions
|
||||||
|
```
|
||||||
|
The written file will have rw-r--rwx permissions for Alice and rw----rwx
|
||||||
|
permissions for Bob as the `toModeWith mask` produces a `Mode` that will only
|
||||||
|
apply the permissions for the 'other' part.
|
||||||
|
-}
|
||||||
|
let Access =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ../../Access/Type.dhall
|
||||||
|
|
||||||
|
let Access/Mask =
|
||||||
|
missing
|
||||||
|
sha256:c0fa7626b69e117086439a7b4ee15d1a80e16e38fe2ccc13f55e6dd26030b4df
|
||||||
|
? ../../Access/Mask/Type.dhall
|
||||||
|
|
||||||
|
let Mode =
|
||||||
|
missing
|
||||||
|
sha256:f05819ec2145e7dabf4aa167338bee6d326aabd81355dcf0b078e358bd34ec60
|
||||||
|
? ../Type.dhall
|
||||||
|
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let Access/equal =
|
||||||
|
missing
|
||||||
|
sha256:5fa90f55505780a7be942275d6bbb2b1f1fb7857364332ed732a0241c2165e53
|
||||||
|
? ../../Access/equal.dhall
|
||||||
|
|
||||||
|
let Access/toAccessWith =
|
||||||
|
missing
|
||||||
|
sha256:814ab74ad292c121620a1f468837d4a5473323423bf68c1bceca69e7b3c59077
|
||||||
|
? ../../Access/Mask/toAccessWith.dhall
|
||||||
|
|
||||||
|
let f
|
||||||
|
: Access/Mask -> Access/Mask -> Optional Access
|
||||||
|
= \(set : Access/Mask) ->
|
||||||
|
\(m : Access/Mask) ->
|
||||||
|
let x = Access/toAccessWith set m
|
||||||
|
|
||||||
|
in if Access/equal
|
||||||
|
{ execute = None Bool, read = None Bool, write = None Bool }
|
||||||
|
x
|
||||||
|
then None Access
|
||||||
|
else Some x
|
||||||
|
|
||||||
|
let toModeWith
|
||||||
|
: Mask -> Mask -> Mode
|
||||||
|
= \(set : Mask) ->
|
||||||
|
\(m : Mask) ->
|
||||||
|
{ user = f set.user m.user
|
||||||
|
, group = f set.group m.group
|
||||||
|
, other = f set.other m.other
|
||||||
|
}
|
||||||
|
|
||||||
|
let example0 =
|
||||||
|
\(a : Mask) ->
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:7cac21e2b72cadf3ee0bf10680df4902ca73b6ee070219df5eac1a24cd66ccdf
|
||||||
|
? ./none.dhall
|
||||||
|
|
||||||
|
let Mode/none =
|
||||||
|
missing
|
||||||
|
sha256:0ed46da7e6acbdff9e4c9e27a9f2770075a7cd6cb6bb565765c62093df1b5563
|
||||||
|
? ../none.dhall
|
||||||
|
|
||||||
|
in assert : toModeWith none a === Mode/none
|
||||||
|
|
||||||
|
let example1 =
|
||||||
|
\(a : Mask) ->
|
||||||
|
let toMode =
|
||||||
|
missing
|
||||||
|
sha256:af2b0dab799374afa0a2f28551446760ff29f4697c200da0a8b0a8def7feee2a
|
||||||
|
? ./toMode.dhall
|
||||||
|
|
||||||
|
let all =
|
||||||
|
missing
|
||||||
|
sha256:758415eca8dfee675dfef93ace9af82abb36bb3319b8e6295537ed18f9b5d3dd
|
||||||
|
? ./all.dhall
|
||||||
|
|
||||||
|
in assert : toModeWith all a === toMode a
|
||||||
|
|
||||||
|
let example2 =
|
||||||
|
let mask =
|
||||||
|
missing
|
||||||
|
sha256:94bf82678d8d1c4f370a96f3831d3ad4464fbee508ffb37e93a479a1d9ee25cf
|
||||||
|
? ./other.dhall
|
||||||
|
|
||||||
|
let permissions =
|
||||||
|
missing
|
||||||
|
sha256:758415eca8dfee675dfef93ace9af82abb36bb3319b8e6295537ed18f9b5d3dd
|
||||||
|
? ./all.dhall
|
||||||
|
|
||||||
|
let rwx = { read = Some True, write = Some True, execute = Some True }
|
||||||
|
|
||||||
|
in assert
|
||||||
|
: toModeWith mask permissions
|
||||||
|
=== { user = None Access, group = None Access, other = Some rwx }
|
||||||
|
|
||||||
|
let example3 =
|
||||||
|
let union =
|
||||||
|
missing
|
||||||
|
sha256:3bb32fc6ea21f661571e46d90e450e0340b2f2b65482ba7bd1a30514e1b39fc2
|
||||||
|
? ./union.dhall
|
||||||
|
|
||||||
|
let group =
|
||||||
|
missing
|
||||||
|
sha256:faa567630372f77bb5cd2fa4fe7cb4760d2f9f79e35df80917e6e0064decf7cf
|
||||||
|
? ./group.dhall
|
||||||
|
|
||||||
|
let other =
|
||||||
|
missing
|
||||||
|
sha256:94bf82678d8d1c4f370a96f3831d3ad4464fbee508ffb37e93a479a1d9ee25cf
|
||||||
|
? ./other.dhall
|
||||||
|
|
||||||
|
let permissions =
|
||||||
|
missing
|
||||||
|
sha256:758415eca8dfee675dfef93ace9af82abb36bb3319b8e6295537ed18f9b5d3dd
|
||||||
|
? ./all.dhall
|
||||||
|
|
||||||
|
let mask = union group other
|
||||||
|
|
||||||
|
let rwx = { read = Some True, write = Some True, execute = Some True }
|
||||||
|
|
||||||
|
in assert
|
||||||
|
: toModeWith mask permissions
|
||||||
|
=== { user = None Access, group = Some rwx, other = Some rwx }
|
||||||
|
|
||||||
|
in toModeWith
|
24
dhall/Prelude/DirectoryTree/Mode/Mask/union.dhall
Normal file
24
dhall/Prelude/DirectoryTree/Mode/Mask/union.dhall
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{-|
|
||||||
|
Calculates the union of the access rights set by both `Mask`s using
|
||||||
|
`Access/union`.
|
||||||
|
-}
|
||||||
|
let Mask =
|
||||||
|
missing
|
||||||
|
sha256:4f97762058f24053e03997565a78800a5a2586159deaa265a4ee84a3d94ad471
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let Access/union =
|
||||||
|
missing
|
||||||
|
sha256:b40c4cbb266991e3f764af075e9db544b59c16b3d9aa680c0cf6cb7552da191f
|
||||||
|
? ../../Access/Mask/union.dhall
|
||||||
|
|
||||||
|
let union
|
||||||
|
: Mask -> Mask -> Mask
|
||||||
|
= \(m1 : Mask) ->
|
||||||
|
\(m2 : Mask) ->
|
||||||
|
{ user = Access/union m1.user m2.user
|
||||||
|
, group = Access/union m1.group m2.group
|
||||||
|
, other = Access/union m1.other m2.other
|
||||||
|
}
|
||||||
|
|
||||||
|
in union
|
14
dhall/Prelude/DirectoryTree/Mode/Mask/user.dhall
Normal file
14
dhall/Prelude/DirectoryTree/Mode/Mask/user.dhall
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{-|
|
||||||
|
Permissions with all user flags set: rwx------
|
||||||
|
-}
|
||||||
|
let rwx =
|
||||||
|
missing
|
||||||
|
sha256:cafda16b1ecc0d2f9a63f3aab229a02e18aebb054283c73e50517f1e3727cd27
|
||||||
|
? ../../Access/Mask/rwx.dhall
|
||||||
|
|
||||||
|
let none =
|
||||||
|
missing
|
||||||
|
sha256:db6c3bb734bb3288441f2664379706052943eaba35c021326a600d41ca766925
|
||||||
|
? ../../Access/Mask/none.dhall
|
||||||
|
|
||||||
|
in { user = rwx, group = none, other = none }
|
10
dhall/Prelude/DirectoryTree/Mode/Type.dhall
Normal file
10
dhall/Prelude/DirectoryTree/Mode/Type.dhall
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{-|
|
||||||
|
An incomplete mode where some access rights might not be set explicitely. For a
|
||||||
|
complete mode with all access rights specified explicitely see `Mask`.
|
||||||
|
-}
|
||||||
|
let Access =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ../Access/Type.dhall
|
||||||
|
|
||||||
|
in { user : Optional Access, group : Optional Access, other : Optional Access }
|
34
dhall/Prelude/DirectoryTree/Mode/equal.dhall
Normal file
34
dhall/Prelude/DirectoryTree/Mode/equal.dhall
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{-|
|
||||||
|
`equal` checks if two `Mode`s are equal.
|
||||||
|
-}
|
||||||
|
let Access =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ../Access/Type.dhall
|
||||||
|
|
||||||
|
let Mode =
|
||||||
|
missing
|
||||||
|
sha256:f05819ec2145e7dabf4aa167338bee6d326aabd81355dcf0b078e358bd34ec60
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
let Access/equal =
|
||||||
|
missing
|
||||||
|
sha256:5fa90f55505780a7be942275d6bbb2b1f1fb7857364332ed732a0241c2165e53
|
||||||
|
? ../Access/equal.dhall
|
||||||
|
|
||||||
|
let Optional/equal =
|
||||||
|
missing
|
||||||
|
sha256:5411888399fe9c6720f7f3b59caf5eff3e8e8c30402d09f34e46a4457649a35a
|
||||||
|
? ../../Optional/equal.dhall
|
||||||
|
|
||||||
|
let f
|
||||||
|
: Optional Access -> Optional Access -> Bool
|
||||||
|
= Optional/equal Access Access/equal
|
||||||
|
|
||||||
|
let equal
|
||||||
|
: Mode -> Mode -> Bool
|
||||||
|
= \(m1 : Mode) ->
|
||||||
|
\(m2 : Mode) ->
|
||||||
|
f m1.user m2.user && f m1.group m2.group && f m1.other m2.other
|
||||||
|
|
||||||
|
in equal
|
9
dhall/Prelude/DirectoryTree/Mode/none.dhall
Normal file
9
dhall/Prelude/DirectoryTree/Mode/none.dhall
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
let Access =
|
||||||
|
missing
|
||||||
|
sha256:50689ae80f8c8dcd6e7af33fbc20ea871afb92ec87104253cdbae01f838f6c38
|
||||||
|
? ../Access/Type.dhall
|
||||||
|
|
||||||
|
in { user = None Access, group = None Access, other = None Access }
|
||||||
|
: missing
|
||||||
|
sha256:f05819ec2145e7dabf4aa167338bee6d326aabd81355dcf0b078e358bd34ec60
|
||||||
|
? ./Type.dhall
|
17
dhall/Prelude/DirectoryTree/Mode/package.dhall
Normal file
17
dhall/Prelude/DirectoryTree/Mode/package.dhall
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ Mask =
|
||||||
|
missing
|
||||||
|
sha256:ce2c7ac1b81c2184b906cdd07c79936ba0eaf0445f1e383f53fd18d688ee7044
|
||||||
|
? ./Mask/package.dhall
|
||||||
|
, Type =
|
||||||
|
missing
|
||||||
|
sha256:f05819ec2145e7dabf4aa167338bee6d326aabd81355dcf0b078e358bd34ec60
|
||||||
|
? ./Type.dhall
|
||||||
|
, equal =
|
||||||
|
missing
|
||||||
|
sha256:32fee2d3a56a2162d6c98fb63d47d31f98b352f22cc60c8b506011c9b5230e56
|
||||||
|
? ./equal.dhall
|
||||||
|
, schema =
|
||||||
|
missing
|
||||||
|
sha256:49f8eff9612d761c1bd424299b68317ad0f3ba325e4d22ec8acb550c2f1c0a40
|
||||||
|
? ./schema.dhall
|
||||||
|
}
|
12
dhall/Prelude/DirectoryTree/Mode/schema.dhall
Normal file
12
dhall/Prelude/DirectoryTree/Mode/schema.dhall
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{-|
|
||||||
|
A schema for a blank file mode.
|
||||||
|
-}
|
||||||
|
{ Type =
|
||||||
|
missing
|
||||||
|
sha256:f05819ec2145e7dabf4aa167338bee6d326aabd81355dcf0b078e358bd34ec60
|
||||||
|
? ./Type.dhall
|
||||||
|
, default =
|
||||||
|
missing
|
||||||
|
sha256:0ed46da7e6acbdff9e4c9e27a9f2770075a7cd6cb6bb565765c62093df1b5563
|
||||||
|
? ./none.dhall
|
||||||
|
}
|
12
dhall/Prelude/DirectoryTree/Tree/Make.dhall
Normal file
12
dhall/Prelude/DirectoryTree/Tree/Make.dhall
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
let Directory =
|
||||||
|
missing
|
||||||
|
sha256:163a4536fdd05ce122d793ceda01d03fcffb29463817ae8b7b5601bf4a06ce6e
|
||||||
|
? ../Entry/DirectoryEntry.dhall
|
||||||
|
|
||||||
|
let File =
|
||||||
|
missing
|
||||||
|
sha256:23a8cb29d96aeb623501519d9a62c5c49659e8d1c30b4ae4f2399809e3fd3a01
|
||||||
|
? ../Entry/FileEntry.dhall
|
||||||
|
|
||||||
|
in \(tree : Type) ->
|
||||||
|
{ directory : Directory tree -> tree, file : File -> tree }
|
6
dhall/Prelude/DirectoryTree/Tree/Type.dhall
Normal file
6
dhall/Prelude/DirectoryTree/Tree/Type.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let Make =
|
||||||
|
missing
|
||||||
|
sha256:235d511ed943dded33b46b1717df263037329394e27fb4b9c677eda5af924458
|
||||||
|
? ./Make.dhall
|
||||||
|
|
||||||
|
in forall (tree : Type) -> forall (make : Make tree) -> List tree
|
32
dhall/Prelude/DirectoryTree/Tree/makeTree.dhall
Normal file
32
dhall/Prelude/DirectoryTree/Tree/makeTree.dhall
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{-|
|
||||||
|
@makeTree tree make parents x@ places the tree @x@ below the directory @parent@.
|
||||||
|
@parent@ is given as a list of 'Metadata' values where each of those will be
|
||||||
|
used to create the respective level of the directory tree.
|
||||||
|
-}
|
||||||
|
let Make =
|
||||||
|
missing
|
||||||
|
sha256:235d511ed943dded33b46b1717df263037329394e27fb4b9c677eda5af924458
|
||||||
|
? ./Make.dhall
|
||||||
|
|
||||||
|
let Metadata =
|
||||||
|
missing
|
||||||
|
sha256:8c240a00094238a73904af63ac0924b3e6aba1655312f20a2a27f88554e2febe
|
||||||
|
? ../Entry/Metadata.dhall
|
||||||
|
|
||||||
|
let makeTree
|
||||||
|
: forall (tree : Type) -> Make tree -> List Metadata -> tree -> tree
|
||||||
|
= \(tree : Type) ->
|
||||||
|
\(make : Make tree) ->
|
||||||
|
\(parents : List Metadata) ->
|
||||||
|
\(leaf : tree) ->
|
||||||
|
List/fold
|
||||||
|
Metadata
|
||||||
|
parents
|
||||||
|
tree
|
||||||
|
( \(directory : Metadata) ->
|
||||||
|
\(result : tree) ->
|
||||||
|
make.directory (directory /\ { content = [ result ] })
|
||||||
|
)
|
||||||
|
leaf
|
||||||
|
|
||||||
|
in makeTree
|
42
dhall/Prelude/DirectoryTree/Tree/makeTreeFromList.dhall
Normal file
42
dhall/Prelude/DirectoryTree/Tree/makeTreeFromList.dhall
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{-|
|
||||||
|
@makeTreeFromList tree make parents xs@ places the trees @xs@ below the
|
||||||
|
directory @parent@. @parent@ is given as a non-empty list of 'Metadata' values
|
||||||
|
where each of those will be used to create the respective level of the directory
|
||||||
|
tree.
|
||||||
|
-}
|
||||||
|
let Make =
|
||||||
|
missing
|
||||||
|
sha256:235d511ed943dded33b46b1717df263037329394e27fb4b9c677eda5af924458
|
||||||
|
? ./Make.dhall
|
||||||
|
|
||||||
|
let Metadata =
|
||||||
|
missing
|
||||||
|
sha256:8c240a00094238a73904af63ac0924b3e6aba1655312f20a2a27f88554e2febe
|
||||||
|
? ../Entry/Metadata.dhall
|
||||||
|
|
||||||
|
let NonEmpty =
|
||||||
|
missing
|
||||||
|
sha256:e2e247455a858317e470e0e4affca8ac07f9f130570ece9cb7ac1f4ea3deb87f
|
||||||
|
? ../../NonEmpty/Type.dhall
|
||||||
|
|
||||||
|
let makeTreesFromList =
|
||||||
|
missing
|
||||||
|
sha256:34ed54a0fc4072cbcb32d0b40adc3ad4e5d978c8dcd7fece9670bf0616f4ab18
|
||||||
|
? ./makeTreesFromList.dhall
|
||||||
|
|
||||||
|
let makeTreeFromList
|
||||||
|
: forall (tree : Type) ->
|
||||||
|
Make tree ->
|
||||||
|
NonEmpty Metadata ->
|
||||||
|
List tree ->
|
||||||
|
tree
|
||||||
|
= \(tree : Type) ->
|
||||||
|
\(make : Make tree) ->
|
||||||
|
\(parents : NonEmpty Metadata) ->
|
||||||
|
\(leaves : List tree) ->
|
||||||
|
make.directory
|
||||||
|
( parents.head
|
||||||
|
/\ { content = makeTreesFromList tree make parents.tail leaves }
|
||||||
|
)
|
||||||
|
|
||||||
|
in makeTreeFromList
|
36
dhall/Prelude/DirectoryTree/Tree/makeTreesFromList.dhall
Normal file
36
dhall/Prelude/DirectoryTree/Tree/makeTreesFromList.dhall
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{-|
|
||||||
|
@makeTreesFromList tree make parents xs@ places the trees @xs@ below the
|
||||||
|
directory @parent@. @parent@ is given as a list of 'Metadata' values where each
|
||||||
|
of those will be used to create the respective level of the directory tree.
|
||||||
|
-}
|
||||||
|
let Make =
|
||||||
|
missing
|
||||||
|
sha256:235d511ed943dded33b46b1717df263037329394e27fb4b9c677eda5af924458
|
||||||
|
? ./Make.dhall
|
||||||
|
|
||||||
|
let Metadata =
|
||||||
|
missing
|
||||||
|
sha256:8c240a00094238a73904af63ac0924b3e6aba1655312f20a2a27f88554e2febe
|
||||||
|
? ../Entry/Metadata.dhall
|
||||||
|
|
||||||
|
let makeTreesFromList
|
||||||
|
: forall (tree : Type) ->
|
||||||
|
Make tree ->
|
||||||
|
List Metadata ->
|
||||||
|
List tree ->
|
||||||
|
List tree
|
||||||
|
= \(tree : Type) ->
|
||||||
|
\(make : Make tree) ->
|
||||||
|
\(parents : List Metadata) ->
|
||||||
|
\(leaves : List tree) ->
|
||||||
|
List/fold
|
||||||
|
Metadata
|
||||||
|
parents
|
||||||
|
(List tree)
|
||||||
|
( \(directory : Metadata) ->
|
||||||
|
\(content : List tree) ->
|
||||||
|
[ make.directory (directory /\ { content }) ]
|
||||||
|
)
|
||||||
|
leaves
|
||||||
|
|
||||||
|
in makeTreesFromList
|
21
dhall/Prelude/DirectoryTree/Tree/package.dhall
Normal file
21
dhall/Prelude/DirectoryTree/Tree/package.dhall
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ Make =
|
||||||
|
missing
|
||||||
|
sha256:235d511ed943dded33b46b1717df263037329394e27fb4b9c677eda5af924458
|
||||||
|
? ./Make.dhall
|
||||||
|
, Type =
|
||||||
|
missing
|
||||||
|
sha256:01820cec8324cb701b6cc99e1dbbc8aacf0115db7795c6c3a023e4f1818fea79
|
||||||
|
? ./Type.dhall
|
||||||
|
, makeTree =
|
||||||
|
missing
|
||||||
|
sha256:e67054bceeb8f55968d89dbaa4b60b726a4ec544e49bd0c5622d5b487610e804
|
||||||
|
? ./makeTree.dhall
|
||||||
|
, makeTreeFromList =
|
||||||
|
missing
|
||||||
|
sha256:ca73533264b52ed9eb29f51e7ac6dfc83c94c9051c5c52486d84b4a3ef7f0274
|
||||||
|
? ./makeTreeFromList.dhall
|
||||||
|
, makeTreesFromList =
|
||||||
|
missing
|
||||||
|
sha256:34ed54a0fc4072cbcb32d0b40adc3ad4e5d978c8dcd7fece9670bf0616f4ab18
|
||||||
|
? ./makeTreesFromList.dhall
|
||||||
|
}
|
1
dhall/Prelude/DirectoryTree/User/Type.dhall
Normal file
1
dhall/Prelude/DirectoryTree/User/Type.dhall
Normal file
|
@ -0,0 +1 @@
|
||||||
|
< UserId : Natural | UserName : Text >
|
6
dhall/Prelude/DirectoryTree/User/id.dhall
Normal file
6
dhall/Prelude/DirectoryTree/User/id.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let User =
|
||||||
|
missing
|
||||||
|
sha256:8b25916612d2c9b17130d16b55c6bdb085dd118e692f72bf351a83b1d0ac8833
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
in User.UserId
|
6
dhall/Prelude/DirectoryTree/User/name.dhall
Normal file
6
dhall/Prelude/DirectoryTree/User/name.dhall
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
let User =
|
||||||
|
missing
|
||||||
|
sha256:8b25916612d2c9b17130d16b55c6bdb085dd118e692f72bf351a83b1d0ac8833
|
||||||
|
? ./Type.dhall
|
||||||
|
|
||||||
|
in User.UserName
|
13
dhall/Prelude/DirectoryTree/User/package.dhall
Normal file
13
dhall/Prelude/DirectoryTree/User/package.dhall
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{ Type =
|
||||||
|
missing
|
||||||
|
sha256:8b25916612d2c9b17130d16b55c6bdb085dd118e692f72bf351a83b1d0ac8833
|
||||||
|
? ./Type.dhall
|
||||||
|
, id =
|
||||||
|
missing
|
||||||
|
sha256:b572ca9f08a04e8e472f1b6141fd71ff27cc7f22d1e72be50eba5f54798b5a6d
|
||||||
|
? ./id.dhall
|
||||||
|
, name =
|
||||||
|
missing
|
||||||
|
sha256:9cfd68599bbd626d3f32c9caa3f09b358ecc08659ef2540b24a4b17b49027015
|
||||||
|
? ./name.dhall
|
||||||
|
}
|
25
dhall/Prelude/DirectoryTree/package.dhall
Normal file
25
dhall/Prelude/DirectoryTree/package.dhall
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ Access =
|
||||||
|
missing
|
||||||
|
sha256:12f2ac90297a81c6e5a548bbf568fc7c93c906a6528432aa74faab6ec859de30
|
||||||
|
? ./Access/package.dhall
|
||||||
|
, Entry =
|
||||||
|
missing
|
||||||
|
sha256:86da03766dbfeab3750ecd1012f6155dd904024351be20085dac3c79f27b22c7
|
||||||
|
? ./Entry/package.dhall
|
||||||
|
, Group =
|
||||||
|
missing
|
||||||
|
sha256:76a0d7e4606bdb91ab001b245cbd411939333b3fc3934ecbb5d41982d1ea001f
|
||||||
|
? ./Group/package.dhall
|
||||||
|
, Mode =
|
||||||
|
missing
|
||||||
|
sha256:6687ff7703fe9abdc4af9b3404af3d1c7d21a523d10a0c0b57d102a0bd87843f
|
||||||
|
? ./Mode/package.dhall
|
||||||
|
, Tree =
|
||||||
|
missing
|
||||||
|
sha256:d2cb84de6b084bfaeb42e6212e7085be9ee03ff2684cf9d04e0d8b4478f42aa7
|
||||||
|
? ./Tree/package.dhall
|
||||||
|
, User =
|
||||||
|
missing
|
||||||
|
sha256:eee7762ea4769371278907a4e33b3808d88430dda32dfc0536dc9bb2bb49d46a
|
||||||
|
? ./User/package.dhall
|
||||||
|
}
|
5
dhall/Prelude/Double/package.dhall
Normal file
5
dhall/Prelude/Double/package.dhall
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{ show =
|
||||||
|
missing
|
||||||
|
sha256:ae645813cc4d8505a265df4d7564c95482f62bb3e07fc81681959599b6cee04f
|
||||||
|
? ./show.dhall
|
||||||
|
}
|
3
dhall/Prelude/Double/show
Normal file
3
dhall/Prelude/Double/show
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:ae645813cc4d8505a265df4d7564c95482f62bb3e07fc81681959599b6cee04f
|
||||||
|
? ./show.dhall
|
13
dhall/Prelude/Double/show.dhall
Normal file
13
dhall/Prelude/Double/show.dhall
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{-|
|
||||||
|
Render a `Double` as `Text` using the same representation as Dhall source
|
||||||
|
code (i.e. a decimal floating point number with a leading `-` sign if negative)
|
||||||
|
-}
|
||||||
|
let show
|
||||||
|
: Double → Text
|
||||||
|
= Double/show
|
||||||
|
|
||||||
|
let example0 = assert : show -3.1 ≡ "-3.1"
|
||||||
|
|
||||||
|
let example1 = assert : show 0.4 ≡ "0.4"
|
||||||
|
|
||||||
|
in show
|
3
dhall/Prelude/Function/compose
Normal file
3
dhall/Prelude/Function/compose
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:65ad8bbea530b3d8968785a7cf4a9a7976b67059aa15e3b61fcba600a40ae013
|
||||||
|
? ./compose.dhall
|
17
dhall/Prelude/Function/compose.dhall
Normal file
17
dhall/Prelude/Function/compose.dhall
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
--| Compose two functions into one.
|
||||||
|
let compose
|
||||||
|
: ∀(a : Type) → ∀(b : Type) → ∀(c : Type) → (a → b) → (b → c) → a → c
|
||||||
|
= λ(A : Type) →
|
||||||
|
λ(B : Type) →
|
||||||
|
λ(C : Type) →
|
||||||
|
λ(f : A → B) →
|
||||||
|
λ(g : B → C) →
|
||||||
|
λ(x : A) →
|
||||||
|
g (f x)
|
||||||
|
|
||||||
|
let example0 =
|
||||||
|
assert
|
||||||
|
: compose Natural Natural Bool (λ(n : Natural) → n + n) Natural/even 3
|
||||||
|
≡ True
|
||||||
|
|
||||||
|
in compose
|
3
dhall/Prelude/Function/identity
Normal file
3
dhall/Prelude/Function/identity
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:f78b96792b459cb664f41c6119bd8897dd04353a3343521d436cd82ad71cb4d4
|
||||||
|
? ./identity.dhall
|
10
dhall/Prelude/Function/identity.dhall
Normal file
10
dhall/Prelude/Function/identity.dhall
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--| The identity function simply returns its input
|
||||||
|
let identity
|
||||||
|
: ∀(a : Type) → ∀(x : a) → a
|
||||||
|
= λ(a : Type) → λ(x : a) → x
|
||||||
|
|
||||||
|
let example0 = assert : identity Natural 1 ≡ 1
|
||||||
|
|
||||||
|
let example1 = assert : identity Bool ≡ (λ(x : Bool) → x)
|
||||||
|
|
||||||
|
in identity
|
9
dhall/Prelude/Function/package.dhall
Normal file
9
dhall/Prelude/Function/package.dhall
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ compose =
|
||||||
|
missing
|
||||||
|
sha256:65ad8bbea530b3d8968785a7cf4a9a7976b67059aa15e3b61fcba600a40ae013
|
||||||
|
? ./compose.dhall
|
||||||
|
, identity =
|
||||||
|
missing
|
||||||
|
sha256:f78b96792b459cb664f41c6119bd8897dd04353a3343521d436cd82ad71cb4d4
|
||||||
|
? ./identity.dhall
|
||||||
|
}
|
3
dhall/Prelude/Integer/abs
Normal file
3
dhall/Prelude/Integer/abs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:35212fcbe1e60cb95b033a4a9c6e45befca4a298aa9919915999d09e69ddced1
|
||||||
|
? ./abs.dhall
|
15
dhall/Prelude/Integer/abs.dhall
Normal file
15
dhall/Prelude/Integer/abs.dhall
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--| Returns the absolute value of an `Integer`, i.e. its non-negative value.
|
||||||
|
let abs
|
||||||
|
: Integer → Natural
|
||||||
|
= λ(n : Integer) →
|
||||||
|
if Natural/isZero (Integer/clamp n)
|
||||||
|
then Integer/clamp (Integer/negate n)
|
||||||
|
else Integer/clamp n
|
||||||
|
|
||||||
|
let example0 = assert : abs +7 ≡ 7
|
||||||
|
|
||||||
|
let example2 = assert : abs +0 ≡ 0
|
||||||
|
|
||||||
|
let example3 = assert : abs -3 ≡ 3
|
||||||
|
|
||||||
|
in abs
|
3
dhall/Prelude/Integer/add
Normal file
3
dhall/Prelude/Integer/add
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:7da1306a0bf87c5668beead2a1db1b18861e53d7ce1f38057b2964b649f59c3b
|
||||||
|
? ./add.dhall
|
25
dhall/Prelude/Integer/add.dhall
Normal file
25
dhall/Prelude/Integer/add.dhall
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
--| `add m n` computes `m + n`.
|
||||||
|
let Integer/subtract =
|
||||||
|
missing
|
||||||
|
sha256:a34d36272fa8ae4f1ec8b56222fe8dc8a2ec55ec6538b840de0cbe207b006fda
|
||||||
|
? ./subtract.dhall
|
||||||
|
|
||||||
|
let add
|
||||||
|
: Integer → Integer → Integer
|
||||||
|
= λ(m : Integer) → λ(n : Integer) → Integer/subtract (Integer/negate m) n
|
||||||
|
|
||||||
|
let example0 = assert : add +3 +5 ≡ +8
|
||||||
|
|
||||||
|
let example1 = assert : add -3 -5 ≡ -8
|
||||||
|
|
||||||
|
let example2 = assert : add -4 +4 ≡ +0
|
||||||
|
|
||||||
|
let example3 = assert : add -3 +5 ≡ +2
|
||||||
|
|
||||||
|
let example4 = assert : add +3 -5 ≡ -2
|
||||||
|
|
||||||
|
let example5 = assert : add +0 -3 ≡ -3
|
||||||
|
|
||||||
|
let example6 = assert : add +0 +3 ≡ +3
|
||||||
|
|
||||||
|
in add
|
3
dhall/Prelude/Integer/clamp
Normal file
3
dhall/Prelude/Integer/clamp
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:ea42096cf3e024fadfaf910e0b839005b0ea7514fff11e5a3950a77694d9c5d2
|
||||||
|
? ./clamp.dhall
|
14
dhall/Prelude/Integer/clamp.dhall
Normal file
14
dhall/Prelude/Integer/clamp.dhall
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{-|
|
||||||
|
Convert an `Integer` to a `Natural` number, with negative numbers becoming zero.
|
||||||
|
-}
|
||||||
|
let clamp
|
||||||
|
: Integer → Natural
|
||||||
|
= Integer/clamp
|
||||||
|
|
||||||
|
let example0 = assert : clamp +7 ≡ 7
|
||||||
|
|
||||||
|
let example2 = assert : clamp +0 ≡ 0
|
||||||
|
|
||||||
|
let example3 = assert : clamp -3 ≡ 0
|
||||||
|
|
||||||
|
in clamp
|
3
dhall/Prelude/Integer/equal
Normal file
3
dhall/Prelude/Integer/equal
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:2d99a205086aa77eea17ae1dab22c275f3eb007bccdc8d9895b93497ebfc39f8
|
||||||
|
? ./equal.dhall
|
24
dhall/Prelude/Integer/equal.dhall
Normal file
24
dhall/Prelude/Integer/equal.dhall
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
--| `equal` checks if two Integers are equal.
|
||||||
|
let Natural/equal =
|
||||||
|
missing
|
||||||
|
sha256:7f108edfa35ddc7cebafb24dc073478e93a802e13b5bc3fd22f4768c9b066e60
|
||||||
|
? ../Natural/equal.dhall
|
||||||
|
|
||||||
|
let equal
|
||||||
|
: Integer → Integer → Bool
|
||||||
|
= λ(a : Integer) →
|
||||||
|
λ(b : Integer) →
|
||||||
|
Natural/equal (Integer/clamp a) (Integer/clamp b)
|
||||||
|
&& Natural/equal
|
||||||
|
(Integer/clamp (Integer/negate a))
|
||||||
|
(Integer/clamp (Integer/negate b))
|
||||||
|
|
||||||
|
let example0 = assert : equal +5 +5 ≡ True
|
||||||
|
|
||||||
|
let example1 = assert : equal +5 +6 ≡ False
|
||||||
|
|
||||||
|
let example2 = assert : equal +5 -5 ≡ False
|
||||||
|
|
||||||
|
let example3 = assert : equal -5 -5 ≡ True
|
||||||
|
|
||||||
|
in equal
|
3
dhall/Prelude/Integer/greaterThan
Normal file
3
dhall/Prelude/Integer/greaterThan
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
missing
|
||||||
|
sha256:d23affd73029fc9aaf867c2c7b86510ca2802d3f0d1f3e1d1a93ffd87b7cb64b
|
||||||
|
? ./greaterThan.dhall
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue