feat: add n-ary either
This commit is contained in:
parent
7b1e389c66
commit
13cc0d3d48
1 changed files with 4 additions and 2 deletions
|
@ -123,8 +123,10 @@ in lib.fix (self: {
|
|||
};
|
||||
};
|
||||
|
||||
either = t1: t2: typedef "either<${t1.name},${t2.name}>"
|
||||
(x: (self.type t1).check x || (self.type t2).check x);
|
||||
eitherN = tn: typedef "either<${concatStringsSep ", " (map (x: x.name) tn)}>"
|
||||
(x: any (t: (self.type t).check x) tn);
|
||||
|
||||
either = t1: t2: self.eitherN [ t1 t2 ];
|
||||
|
||||
list = t: typedef' rec {
|
||||
name = "list<${t.name}>";
|
||||
|
|
Loading…
Reference in a new issue