• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

functionaljava/functionaljava: Functional programming in Java

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

functionaljava/functionaljava

开源软件地址:

https://github.com/functionaljava/functionaljava

开源编程语言:

Java 96.9%

开源软件介绍:

Functional Java

Build Status Code Coverage functionaljava

logo 600x144

Functional Java is an open source library facilitating functional programming in Java. The library implements numerous basic and advanced programming abstractions that assist composition oriented development. Functional Java also serves as a platform for learning functional programming concepts by introducing these concepts using a familiar language.

The library is intended for use in production applications and is thoroughly tested using the technique of automated specification-based testing with ScalaCheck and Functional Java’s quickcheck module.

Functional Java provides abstractions for the following types:

  • Basic Data Structures - total and partial functions, products, unit, option, unbiased and right biased unions (either and validation), void.

  • Immutable Collections - array, list, vector, stream, set, map, priority queue, finger tree, heterogenous list, difference list.

  • Other Abstractions - monoid, semigroup, natural, random number generator, reader, writer, state, input/output, parser, zipper, specification based testing (quickcheck), actors, optics (lens, prism, fold, traversal and others), concurrency and type conversion.

Downloading

The recommended way to download and use the project is through your build tool.

The Functional Java artifact is published to Maven Central using the group org.functionaljava with three published artifacts:

  • the core library (functionaljava)

  • property based testing (functionaljava-quickcheck)

  • a small amount of Java 8 support (functionaljava-java-core)

The latest stable version is 5.0. This can be added to your Gradle project by adding the dependencies:

compile "org.functionaljava:functionaljava:5.0"
compile "org.functionaljava:functionaljava-quickcheck:5.0"
compile "org.functionaljava:functionaljava-java-core:5.0"

and in Maven:

<dependency>
    <groupId>org.functionaljava</groupId>
    <artifactId>functionaljava</artifactId>
    <version>5.0</version>
</dependency>
<dependency>
    <groupId>org.functionaljava</groupId>
    <artifactId>functionaljava-quickcheck</artifactId>
    <version>5.0</version>
</dependency>
<dependency>
    <groupId>org.functionaljava</groupId>
    <artifactId>functionaljava-java-core</artifactId>
    <version>5.0</version>
</dependency>

Building

Building is done using Java 8 and Gradle 7.4. In the root directory run:

./gradlew

This requires access to Java 8 and will download the Gradle build tool and necessary dependencies and build FunctionalJava.

Features

A more complete description of the features mentioned above are:

  • Basic Data Structures

    • Functions with arity 1 to 8 (fj.F).

    • Functions with arity 0 to 8 that can produce exceptions (fj.Try).

    • Functions with arity 0 to 8 that have a void return (fj.Effect).

    • Functions with arity 0 to 8 that have a void return and can throw an exception (fj.TryEffect).

    • Products with arity 1 to 8 (fj.P).

    • Unit type (fj.Unit).

    • Optional value - type-safe null (fj.data.Option).

    • Disjoint union data type - compositional exception handling (fj.data.Either).

    • Validation - right biased compositional exception handling (fj.data.Validation).

  • Immutable Collections

    • Array wrapper (fj.data.Array).

    • Immutable, in-memory singly linked list (fj.data.List).

    • Immutable lazy singly linked list (fj.data.Stream).

    • A package (fj.data.fingertrees) providing 2-3 finger trees for a functional representation of persistent sequences, supporting access to the ends in amortized O(1) time.

    • Type-safe heterogeneous list (fj.data.hlist) for lists of elements of differing types without sacrificing type-safety.

    • Immutable set implementation using a red/black tree (fj.data.Set).

    • Immutable multi-way tree - aka rose tree (fj.data.Tree).

    • Immutable tree-map using a red/black tree implementation (fj.data.TreeMap).

    • Immutable priority queue using finger trees (fj.data.PriorityQueue).

    • Difference lists, a highly performant list.

  • Other Abstractions

    • Monoid (fj.Monoid).

    • Semigroup (fj.Semigroup).

    • Natural number data type (fj.data.Natural).

    • Random number generator using a linear congruential generator (fj.LcgRng).

    • Reader, Writer and State monads (fj.data.Reader,fj.data.Writer, fj.data.State).

    • Input/Output monad for abstracting IO (fj.IO).

    • Monadic parser combinators for writing parsers by combining smaller parsers using composition.

    • Conversion of data types to/from standard Java types.

    • Conversion between FunctionalJava and Java 8 specific types.

    • Configurable equality and hash-code for HashMap and HashSet.

    • Zipper implementations for streams and trees.

    • Automated specification-based testing framework (fj.test).

    • Fully operational Actors for parallel computations (fj.control.parallel) and layered abstractions such as parallel-map, map-reduce, parallel-zip.

    • Optics for updating immutable data including lens, prism, iso, optional, traversal, getter, fold and setter. Inspired by the Scala Monocle library (https://github.com/julien-truffaut/Monocle) and the Haskell lens library (https://github.com/ekmett/lens).

    • Void, a logically uninhabited type.

License

The Functional Java license uses the BSD 3 license (3-clause license) available at https://en.wikipedia.org/wiki/BSD_licenses.

Release Notes

For release notes for each version, see the directory link:etc/release-notes.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap