Skip to content

Commit

Permalink
lib/types: defaultTypeMerge move wrapped into payload
Browse files Browse the repository at this point in the history
  • Loading branch information
hsjobeki committed Nov 7, 2024
1 parent d2dfc1a commit 7e783c2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ rec {
&& (f.payload == null && f'.payload == null)
then f.type
# composed types
else if (f.wrapped != null && f'.wrapped != null) && (wrapped != null)
else if (f.wrapped != null && f'.wrapped != null)
then f.type wrapped
# value types
else if (f.payload != null && f'.payload != null) && (payload != null)
else if (f.payload != null && f'.payload != null)
then f.type payload
else null;

Expand Down Expand Up @@ -583,7 +583,11 @@ rec {
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name>"]);
getSubModules = elemType.getSubModules;
substSubModules = m: attrsOf (elemType.substSubModules m);
functor = (defaultFunctor name) // { wrapped = elemType; };
functor = (defaultFunctor name) // {
payload.wrapped = elemType;
type = payload: attrsOf payload.wrapped;
binOp = lhs: rhs: { wrapped = lhs.wrapped.typeMerge rhs.wrapped.functor; };
};
nestedTypes.elemType = elemType;
};

Expand Down

0 comments on commit 7e783c2

Please sign in to comment.