aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/core/functional/init.lua
blob: 6987e1a732e90cbc53e09907ebefb239e07453d8 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
local _ = {}

-- data
local data = require "nvim-lsp-installer.core.functional.data"
_.table_pack = data.table_pack
_.enum = data.enum
_.set_of = data.set_of

-- function
local fun = require "nvim-lsp-installer.core.functional.function"
_.curryN = fun.curryN
_.compose = fun.compose
_.partial = fun.partial
_.identity = fun.identity
_.always = fun.always
_.T = fun.T
_.F = fun.F
_.memoize = fun.memoize
_.lazy = fun.lazy

-- list
local list = require "nvim-lsp-installer.core.functional.list"
_.reverse = list.reverse
_.list_not_nil = list.list_not_nil
_.list_copy = list.list_copy
_.find_first = list.find_first
_.any = list.any
_.filter = list.filter
_.map = list.map
_.each = list.each
_.concat = list.concat
_.zip_table = list.zip_table
_.nth = list.nth
_.head = list.head

-- relation
local relation = require "nvim-lsp-installer.core.functional.relation"
_.equals = relation.equals
_.prop_eq = relation.prop_eq
_.prop_satisfies = relation.prop_satisfies

-- logic
local logic = require "nvim-lsp-installer.core.functional.logic"
_.all_pass = logic.all_pass
_.if_else = logic.if_else
_.is_not = logic.is_not
_.complement = logic.complement
_.cond = logic.cond

-- number
local number = require "nvim-lsp-installer.core.functional.number"
_.negate = number.negate
_.gt = number.gt
_.gte = number.gte
_.lt = number.lt
_.lte = number.lte
_.inc = number.inc
_.dec = number.dec

-- string
local string = require "nvim-lsp-installer.core.functional.string"
_.matches = string.matches
_.format = string.format
_.split = string.split

-- table
local tbl = require "nvim-lsp-installer.core.functional.table"
_.prop = tbl.prop

-- type
local typ = require "nvim-lsp-installer.core.functional.type"
_.is_nil = typ.is_nil
_.is = typ.is

-- TODO do something else with these

_.coalesce = function(...)
    local args = _.table_pack(...)
    for i = 1, args.n do
        local variable = args[i]
        if variable ~= nil then
            return variable
        end
    end
end

_.when = function(condition, value)
    return condition and value or nil
end

_.lazy_when = function(condition, value)
    return condition and value() or nil
end

return _