query
On this page

intersection

lib.fileset.intersection

Docs pulled from | This Revision | about 1 hour ago


The file set containing all files that are in both of two given file sets. See also Intersection (set theory).

The given file sets are evaluated as lazily as possible, with the first argument being evaluated first if needed.

Inputs

fileset1

The first file set. This argument can also be a path, which gets implicitly coerced to a file set.

fileset2

The second file set. This argument can also be a path, which gets implicitly coerced to a file set.

Type

intersection :: FileSet -> FileSet -> FileSet

Examples

lib.fileset.intersection usage example

# Limit the selected files to the ones in ./., so only ./src and ./Makefile
intersection ./. (unions [ ../LICENSE ./src ./Makefile ])

Noogle detected

Implementation

The following is the current implementation of this function.

intersection =
    fileset1: fileset2:
    let
      filesets = _coerceMany "lib.fileset.intersection" [
        {
          context = "First argument";
          value = fileset1;
        }
        {
          context = "Second argument";
          value = fileset2;
        }
      ];
    in
    _intersection (elemAt filesets 0) (elemAt filesets 1);