-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest copy.nix
125 lines (96 loc) · 1.9 KB
/
test copy.nix
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
rec {
# __intern = {
# a =1;
# };
# public = { b = 1;};
# }
# foo = "This is an error";
# a = {
# inherit lib;
# };
# lib = {
# map = _f: 1;
# };
}
# inherit (pkgs.lib) mirrorFunctionArgs; #) makeScopeWithSplicing';
# setFunctionArgs = f: args:
# {
# __functor = self: a: b: c: 1;
# # __functionArgs = args;
# };
# functionArgs = f:
# if f ? __functor
# then f.__functionArgs or (functionArgs (f.__functor f))
# else builtins.functionArgs f;
# mirrorFunctionArgs' =
# f:
# let
# fArgs = functionArgs f;
# in
# g:
# setFunctionArgs g fArgs;
# fn =
# x:
# {pkgs ,lib ? pkgs.lib, ...}:
# {
# __functor = super: {arg ? null}:
# { __functor = self: {arg ? null}:
# {x,y}:
# 1;
# };
# };
# User facing arguments:
# x, op, list
# f = map;
# g = map (x: x);
# fix = f: let x = f x; in x;
# Simple case:
# f = {
# __functor = self: {a,b}: {x,y}: true;
# };
# Simple primops
# d = map 1;
# Functions that return operate on functions:
# toFunctor
# g = f: h: {
# __functor = self: f;
# };
# simple (infinte) recursion
# c = { a }: _: c;
# cross (infinite) recursion
# a Any->b Any-> a ....
# a = _: b;
# b = _: a;
# setFunctionArgs
# setFunctionArgs = f: args:
# {
# __functor = self: f;
# __functionArgs = args;
# };
# mirrorFunctionArgs = f:
# inherit (pkgs) lib;
# fn = args@{b,c ? {},d, ...}: x: c: d: 1;
# a = {
# # The id function
# inherit a;
# };
# a = {
# # The id function
# e = throw "This is a boobytrap";
# };
# b = {
# inherit a;
# inherit b;
# };
# b = {
# inherit a;
# inherit b;
# };
# errors = { a = throw "Some funny boobytrap"; };
# errors = throw "Some funny boobytrap";
# errors = { ${throw "Some funny boobytrap" } = 1; };
# # import invalid file
# c = import ./b.nix;
# lib = import <nixpkgs/lib>;
# writers = (import <nixpkgs> {}).writers;
# }