public static function each(callable $function, $input)
    {
        if ($input instanceof FoldableInterface) {
            $input->foldl(function ($acc, $x) use ($function) {
                $function($x);
            }, null);

            return;
        } elseif ($input instanceof LeftFoldableInterface) {
            $input->foldl(function ($x) use ($function) {
                $function($x);
            }, null);

            return;
        }

        static::map($function, $input);
    }