summaryrefslogtreecommitdiff
path: root/dhall/src/error/text/InvalidOptionalLiteral.txt
blob: 41c0fdc6f32dbe19699369b77966c7a5445f3392 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Explanation: The syntax for ❰Optional❱ values resembles the syntax for ❰List❱s:


    ┌───────────────────────┐
    │ [] : Optional Integer │  An ❰Optional❱ value which is absent
    └───────────────────────┘


    ┌───────────────────────┐
    │ [] : List     Integer │  An empty (0-element) ❰List❱
    └───────────────────────┘


    ┌────────────────────────┐
    │ [1] : Optional Integer │  An ❰Optional❱ value which is present
    └────────────────────────┘


    ┌────────────────────────┐
    │ [1] : List     Integer │  A singleton (1-element) ❰List❱
    └────────────────────────┘


However, an ❰Optional❱ value can $_NOT have more than one element, whereas a
❰List❱ can have multiple elements:


    ┌───────────────────────────┐
    │ [1, 2] : Optional Integer │  Invalid: multiple elements $_NOT allowed
    └───────────────────────────┘


    ┌───────────────────────────┐
    │ [1, 2] : List     Integer │  Valid: multiple elements allowed
    └───────────────────────────┘


Your ❰Optional❱ value had this many elements:

↳ $txt0

... when an ❰Optional❱ value can only have at most one element

Some common reasons why you might get this error:

● You accidentally typed ❰Optional❱ when you meant ❰List❱, like this:


    ┌────────────────────────────────────────────────────┐
    │ List/length Integer ([1, 2, 3] : Optional Integer) │
    └────────────────────────────────────────────────────┘
                                       ⇧
                                       This should be ❰List❱ instead