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 7f14388
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ rec {
else if (f.wrapped == null && f'.wrapped == null)
&& (f.payload == null && f'.payload == null)
then f.type
# composed types
else if (f.wrapped != null && f'.wrapped != null) && (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
# composed types
else if (f.wrapped != null && f'.wrapped != null)
then f.type wrapped
else null;

# Default type functor
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 7f14388

Please sign in to comment.