File: doc-functor.expected

package info (click to toggle)
nix 2.26.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,524 kB
  • sloc: cpp: 87,540; sh: 8,864; perl: 649; yacc: 466; xml: 410; javascript: 378; lex: 329; ansic: 215; python: 128; sql: 56; makefile: 33; exp: 5; ruby: 1
file content (101 lines) | stat: -rw-r--r-- 2,781 bytes parent folder | download
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
Nix <nix version>
Type :? for help.

nix-repl> :l doc-functor.nix
Added <number omitted> variables.

nix-repl> :doc multiplier
Function `__functor`\
  … defined at /path/to/tests/functional/repl/doc-functor.nix:12:23


Multiply the argument by the factor stored in the factor attribute.

nix-repl> :doc doubler
Function `multiply`\
  … defined at /path/to/tests/functional/repl/doc-functor.nix:5:17


Look, it's just like a function!

nix-repl> :doc recursive
Function `__functor`\
  … defined at /path/to/tests/functional/repl/doc-functor.nix:82:23


This looks bad, but the docs are ok because of the eta expansion.

nix-repl> :doc recursive2
error:
       … while partially calling '__functor' to retrieve documentation

       … while calling '__functor'
         at /path/to/tests/functional/repl/doc-functor.nix:90:17:
           89|     */
           90|     __functor = self: self.__functor self;
             |                 ^
           91|   };

       … from call site
         at /path/to/tests/functional/repl/doc-functor.nix:90:23:
           89|     */
           90|     __functor = self: self.__functor self;
             |                       ^
           91|   };

       (19999 duplicate frames omitted)

       error: stack overflow; max-call-depth exceeded
       at /path/to/tests/functional/repl/doc-functor.nix:90:23:
           89|     */
           90|     __functor = self: self.__functor self;
             |                       ^
           91|   };

nix-repl> :doc diverging
error:
       … while partially calling '__functor' to retrieve documentation

       (10000 duplicate frames omitted)

       … while calling '__functor'
         at /path/to/tests/functional/repl/doc-functor.nix:103:21:
          102|       f = x: {
          103|         __functor = self: (f (x + 1));
             |                     ^
          104|       };

       error: stack overflow; max-call-depth exceeded
       at /path/to/tests/functional/repl/doc-functor.nix:103:28:
          102|       f = x: {
          103|         __functor = self: (f (x + 1));
             |                            ^
          104|       };

nix-repl> :doc helper
Function `square`\
  … defined at /path/to/tests/functional/repl/doc-functor.nix:36:12


Compute x^2

nix-repl> :doc helper2
Function `__functor`\
  … defined at /path/to/tests/functional/repl/doc-functor.nix:46:13


This is a function that can be overridden.

nix-repl> :doc lib.helper3
Function `__functor`\
  … defined at /path/to/tests/functional/repl/doc-functor.nix:46:13


This is a function that can be overridden.

nix-repl> :doc helper3
Function `__functor`\
  … defined at /path/to/tests/functional/repl/doc-functor.nix:46:13


This is a function that can be overridden.