{"id":32423369,"url":"https://github.com/amarpotghan/scala-fold","last_synced_at":"2025-10-25T18:58:58.134Z","repository":{"id":57728264,"uuid":"62812524","full_name":"amarpotghan/scala-fold","owner":"amarpotghan","description":"Composable folds","archived":false,"fork":false,"pushed_at":"2018-07-18T14:55:40.000Z","size":62,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-07-02T11:39:56.878Z","etag":null,"topics":["composable","fold","scala"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amarpotghan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-07T14:18:59.000Z","updated_at":"2021-08-23T15:22:11.000Z","dependencies_parsed_at":"2022-09-26T22:00:27.086Z","dependency_job_id":null,"html_url":"https://github.com/amarpotghan/scala-fold","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/amarpotghan/scala-fold","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarpotghan%2Fscala-fold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarpotghan%2Fscala-fold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarpotghan%2Fscala-fold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarpotghan%2Fscala-fold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amarpotghan","download_url":"https://codeload.github.com/amarpotghan/scala-fold/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarpotghan%2Fscala-fold/sbom","scorecard":{"id":188423,"data":{"date":"2025-08-11","repo":{"name":"github.com/amarpotghan/scala-fold","commit":"32bd29cc856cda751f237b204c808df5064cea82"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T20:12:04.019Z","repository_id":57728264,"created_at":"2025-08-16T20:12:04.114Z","updated_at":"2025-08-16T20:12:04.114Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281003891,"owners_count":26428018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composable","fold","scala"],"created_at":"2025-10-25T18:57:02.900Z","updated_at":"2025-10-25T18:58:58.126Z","avatar_url":"https://github.com/amarpotghan.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/amarpotghan/scala-fold.svg?branch=master)](https://travis-ci.org/amarpotghan/scala-fold)\n# scala-fold\nComposable folds in Scala\n\n# Introduction\n\nThis library defines the `Foldl` data type (a left fold) which can be combined in the applicative style such that resulting\nfold requires only one traversal over the given structure.\n\nLibrary comes with common folds. You can always define your own fold by providing a step function and initial value.\n\nLibrary also comes with an extension method on scala's standard collections `foldWith`. You can use that on standard scala collections as follows,\n\n```scala\nimport fold._\nimport Fold._\n\nList(1, 2, 3).foldWith(sum[Int])\n\n```\n\n# Examples\n\n## Simple sum of integers\n\n```scala\n\nscala\u003e import fold._\nimport fold._\n\nscala\u003e import Fold._\nimport Fold._\n\nscala\u003e Seq(1, 2, 3).foldWith(sum[Int])\nres1: Int = 6\n\n```\n\n## `Foldl`s are Applicatives, so we can compose `Foldl`s using applicative style:\n\n```scala\n\nscala\u003e import fold._\nimport fold._\n\nscala\u003e import Fold._\nimport Fold._\n\nscala\u003e import scalaz._\nimport scalaz._\n\nscala\u003e type Fold[A] = Foldl[Double, A]\ndefined type alias Fold\n\nscala\u003e def mean = Apply[Fold].apply2(sum[Double], length[Double, Double])(_ / _)\nmean: Fold[Double]\n\nscala\u003e Seq(1.0, 2.0, 3.0).foldWith(mean)\nres1: Double = 2.0\n\n```\nNote that combined mean fold traverses List only once!\n\n## Using Applicative syntax of Scalaz\n\n```scala\n\nscala\u003e import fold._\nscala\u003e import Fold._\n\nscala\u003e  import scalaz.syntax.apply._\nimport scalaz.syntax.apply._\n\nscala\u003e def mean = (sum[Double] |@| length[Double, Double]) (_ / _)\nmean: fold.Foldl[Double,Double]\n\nscala\u003e Seq(1.0, 2.0, 3.0).foldWith(mean)\nres3: Double = 2.0\n\n```\n## You can also conveniently use numeric operations on `Foldl`:\n\n```scala\n\nscala\u003e import fold._\nimport fold._\n\nscala\u003e import Fold._\nimport Fold._\n\nscala\u003e def mean = sum[Double] / length[Double, Double]\nmean: fold.Foldl[Double,Double]\n\nscala\u003e Seq(1.0, 2.0, 3.0).foldWith(mean)\nres2: Double = 2.0\n\n```\n`(/)` function uses Foldl's applicative instance, so again List is traversed only once.\n\n\n# Credits\n\n* [Gabriel Gonzalez](https://github.com/Gabriel439)'s [foldl library](https://hackage.haskell.org/package/foldl)\n* Phil Freeman's [purescript-folds](https://github.com/paf31/purescript-folds)\n* Max Rabkin’s [Beautiful folding](http://squing.blogspot.sg/2008/11/beautiful-folding.html)\n* Conal Elliott's [blogpost](http://conal.net/blog/posts/another-lovely-example-of-type-class-morphisms)\n\n\nFeedbacks welcome!\n\n# LICENSE\n\nDistributed under the [Apache 2.0](LICENSE).\nCopyright © 2016-2018 Amar Potghan.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarpotghan%2Fscala-fold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famarpotghan%2Fscala-fold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarpotghan%2Fscala-fold/lists"}