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
96
97
98
99
100
101
|
module Lib exposing (bare, eName, eValue, expressionNs, false, float, floats, get, int, layerNs, pipelineCall, pipelineMultiCall, sourceNs, str, styleNs, todo, true, zoom)
import MyElm.Advanced as Advanced
import MyElm.Syntax as Elm exposing (Expression)
styleNs =
[ "Mapbox", "Style" ]
layerNs =
[ "Mapbox", "Layer" ]
expressionNs =
[ "Mapbox", "Expression" ]
sourceNs =
[ "Mapbox", "Source" ]
eName name =
Advanced.aliasedName { modulePath = expressionNs, aliasName = "E", name = name, typeName = Nothing }
bare =
Advanced.exposedName expressionNs
zoom : Expression
zoom =
Elm.call0 (eName "zoom")
true : Expression
true =
Elm.call0 (bare "true")
false : Expression
false =
Elm.call0 (bare "false")
float : Expression -> Expression
float =
Elm.call1 (bare "float")
floats : Expression -> Expression
floats =
Elm.call1 (eName "floats")
int : Expression -> Expression
int =
Elm.call1 (bare "int")
str : Expression -> Expression
str =
Elm.call1 (bare "str")
eValue : String -> Expression
eValue =
eName >> Elm.call0
get : Expression -> Expression
get =
Elm.call1 (eName "get")
todo : String -> Expression
todo msg =
Elm.call1 (Elm.valueName [ "Debug" ] "todo") (Elm.string msg)
pipelineCall : String -> List Expression -> Expression
pipelineCall name args =
case args of
fst :: rest ->
Elm.call2 (Elm.local "|>")
fst
(Elm.calln (eName name) rest)
_ ->
todo <| "Wrong number of arguments passed to E." ++ name
pipelineMultiCall : String -> List Expression -> Expression
pipelineMultiCall name args =
case args of
fst :: rest ->
List.map (Elm.call1 (eName name)) rest
|> List.foldl (\a b -> Elm.call2 (Elm.local "|>") b a) fst
_ ->
todo <| "Wrong number of arguments passed to E." ++ name
|