All Projects → functionaljava → Functionaljava

functionaljava / Functionaljava

Functional programming in Java

Programming Languages

java
68154 projects - #9 most used programming language
scala
5932 projects

Projects that are alternatives of or similar to Functionaljava

Static Land
Specification for common algebraic structures in JavaScript based on Fantasy Land
Stars: ✭ 699 (-52.51%)
Mutual labels:  monad, algebraic-data-types, algebra, functional-programming
Lambda
Functional patterns for Java
Stars: ✭ 737 (-49.93%)
Mutual labels:  monad, algebraic-data-types, functional-programming
Witchcraft
Monads and other dark magic for Elixir
Stars: ✭ 864 (-41.3%)
Mutual labels:  monad, algebraic-data-types, algebra
Bow
🏹 Bow is a cross-platform library for Typed Functional Programming in Swift
Stars: ✭ 538 (-63.45%)
Mutual labels:  monad, functional-programming, effects
Fp Resources
Functional programming great resources
Stars: ✭ 369 (-74.93%)
Mutual labels:  monad, algebra, functional-programming
Purify
Functional programming library for TypeScript - https://gigobyte.github.io/purify/
Stars: ✭ 843 (-42.73%)
Mutual labels:  monad, algebraic-data-types, functional-programming
Scriptum
A fool's scriptum on functional programming
Stars: ✭ 346 (-76.49%)
Mutual labels:  monad, algebraic-data-types, functional-programming
Fluture
🦋 Fantasy Land compliant (monadic) alternative to Promises
Stars: ✭ 2,249 (+52.79%)
Mutual labels:  monad, algebraic-data-types, functional-programming
Language Ext
C# functional language extensions - a base class library for functional programming
Stars: ✭ 3,964 (+169.29%)
Mutual labels:  monad, functional-programming, monoid
Derive4j
Java 8 annotation processor and framework for deriving algebraic data types constructors, pattern-matching, folds, optics and typeclasses.
Stars: ✭ 511 (-65.29%)
Mutual labels:  algebraic-data-types, algebra, functional-programming
Fp Core.rs
A library for functional programming in Rust
Stars: ✭ 772 (-47.55%)
Mutual labels:  monad, functional-programming
Learn Fp
learn-by-doing course/tutorial for functional programming on scala
Stars: ✭ 548 (-62.77%)
Mutual labels:  monad, functional-programming
Enum Fp
Functional Enum type / Sum type for javascript with simple pattern matching
Stars: ✭ 27 (-98.17%)
Mutual labels:  algebraic-data-types, functional-programming
Rings
Rings: efficient JVM library for polynomial rings
Stars: ✭ 50 (-96.6%)
Mutual labels:  algebraic-data-types, algebra
Purefun
Functional Programming library for Java
Stars: ✭ 37 (-97.49%)
Mutual labels:  monad, functional-programming
Cats Stm
An STM implementation for Cats Effect
Stars: ✭ 106 (-92.8%)
Mutual labels:  monad, functional-programming
Fx Ts
Computational environments and effects for TypeScript
Stars: ✭ 42 (-97.15%)
Mutual labels:  functional-programming, effects
Cyclops
An advanced, but easy to use, platform for writing functional applications in Java 8.
Stars: ✭ 1,180 (-19.84%)
Mutual labels:  monad, functional-programming
Momi
Monadic middleware
Stars: ✭ 57 (-96.13%)
Mutual labels:  monad, algebraic-data-types
Pfun
Functional, composable, asynchronous, type-safe Python.
Stars: ✭ 75 (-94.9%)
Mutual labels:  functional-programming, effects

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 is compiled with Java 8 targeting Java 7 bytecode. The use of lambdas within the project are backported with the Retro Lambda library, supporting Java versions 6 to 8.

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 or functionaljava_1.8 if you use Java 8+)

  • Java 8 specific support (functionaljava-java8)

  • property based testing (functionaljava-quickcheck or functionaljava-quickcheck_1.8 if you use Java 8+)

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

compile "org.functionaljava:functionaljava:4.8.1"
compile "org.functionaljava:functionaljava-java8:4.8.1"
compile "org.functionaljava:functionaljava-quickcheck:4.8.1"
compile "org.functionaljava:functionaljava-java-core:4.8.1"

and in Maven:

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

Building

FunctionalJava uses the Retro Lambda project to backport Java 8 lambdas to Java 6 bytecode. This requires access to both JDK 6 and 8. The build system requires the environment variables JAVA6_HOME and JAVA8_HOME to refer to the appropriate directories.

Building is done using Gradle 2.13. In the root directory run:

./gradlew

This requires access to Java 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 etc/release-notes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].