query
On this page

functionTo

lib.types.functionTo

Docs pulled from | This Revision | 19 minutes ago


Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.

Noogle detected

Implementation

The following is the current implementation of this function.

elemType:
    mkOptionType {
      name = "functionTo";
      description = "function that evaluates to a(n) ${
        optionDescriptionPhrase (class: class == "noun" || class == "composite") elemType
      }";
      descriptionClass = "composite";
      check = isFunction;
      merge = loc: defs: {
        # An argument attribute has a default when it has a default in all definitions
        __functionArgs = zipAttrsWith (_: all (x: x)) (map (fn: functionArgs fn.value) defs);
        __functor =
          _: callerArgs:
          (mergeDefinitions (loc ++ [ "<function body>" ]) elemType (
            map (fn: {
              inherit (fn) file;
              value = fn.value callerArgs;
            }) defs
          )).mergedValue;
      };
      getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "<function body>" ]);
      getSubModules = elemType.getSubModules;
      substSubModules = m: functionTo (elemType.substSubModules m);
      functor = (elemTypeFunctor "functionTo" { inherit elemType; }) // {
        type = payload: lib.types.functionTo payload.elemType;
      };
      nestedTypes.elemType = elemType;
    }