You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

LanguageExt.Core

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

LanguageExt.Core

This library uses and abuses the features of C# to provide a functional 'Base class library', that, if you squint, can look like extensions to the language itself.

5.0.0-beta-54
Source
nugetNuGet
Version published
Maintainers
1
Created
Source

LanguageExt.Core

LanguageExt.Core is the primary library in the language-ext functional programming framework.

The framework uses and abuses the features of C# to provide a pure functional-programming 'Base Class Library' that, if you squint, can look like extensions to the language itself. The desire here is to make programming in C# much more robust by helping the engineer's inertia flow in the direction of declarative and pure functional code rather than imperative.

Using these techniques for large code-bases can bring tangible benefits to long-term maintenance by removing hidden complexity and by easing the engineer's cognitive load.

Features

Functional effects and IO

LocationFeatureDescription
CoreIO<A>A synchronous and asynchronous side-effect: an IO monad
CoreEff<A>A synchronous and asynchronous side-effect with error handling
CoreEff<RT, A>Same as Eff<A> but with an injectable runtime for dependency-injection: a unit testable IO monad
CorePipesA clean and powerful stream processing system that lets you build and connect reusable streaming components
CoreStreamTless powerful (than Pipes), but easier to use streaming effects transformer

Atomic concurrency and collections

LocationFeatureDescription
CoreAtom<A>A lock-free atomically mutable reference for working with shared state
CoreRef<A>An atomic reference to be used in the transactional memory system
CoreAtomHashMap<K, V>An immutable HashMap with a lock-free atomically mutable reference
CoreAtomSeq<A>An immutable Seq with a lock-free atomically mutable reference
CoreVectorClock<A>Understand distributed causality
CoreVersionVector<A>A vector clock with some versioned data
CoreVersionHashMap <ConflictV, K, V>Distrubuted atomic versioning of keys in a hash-map

Immutable collections

LocationFeatureDescription
CoreArr<A>Immutable array
CoreSeq<A>Lazy immutable list, evaluate at-most-once - very, very fast!
CoreIterable<A>Wrapper around IEnumerable with support for traits - enables the higher-kinded traits to work with enumerables.
CoreLst<A>Immutable list - use Seq over Lst unless you need InsertAt
CoreMap<K, V>Immutable map
CoreMap<OrdK, K, V>Immutable map with Ord constraint on K
CoreHashMap<K, V>Immutable hash-map
CoreHashMap<EqK, K, V>Immutable hash-map with Eq constraint on K
CoreSet<A>Immutable set
CoreSet<OrdA, A>Immutable set with Ord constraint on A
CoreHashSet<A>Immutable hash-set
CoreHashSet<EqA, A>Immutable hash-set with Eq constraint on A
CoreQue<A>Immutable queue
CoreStck<A>Immutable stack

Optional and alternative value monads

LocationFeatureDescription
CoreOption<A>Option monad
CoreOptionT<M, A>Option monad-transformer
CoreEither<L,R>Right/Left choice monad
CoreEitherT<L, M, R>Right/Left choice monad-transformer
CoreFin<A>Error handling monad, like Either<Error, A>
CoreFinT<M, A>Error handling monad-transformer
CoreTry<A>Exception handling monad
CoreTryT<M, A>Exception handling monad-transformer
CoreValidation<FAIL ,SUCCESS>Validation applicative and monad for collecting multiple errors before aborting an operation
CoreValidationT<FAIL, M, SUCCESS>Validation applicative and monad-transformer

State managing monads

LocationFeatureDescription
CoreReader<E, A>Reader monad
CoreReaderT<E, M, A>Reader monad-transformer
CoreWriter<W, A>Writer monad that logs to a W constrained to be a Monoid
CoreWriterT<W, M, A>Writer monad-transformer
CoreState<S, A>State monad
CoreStateT<S, M, A>State monad-transformer

Parser combinators

LocationFeatureDescription
ParsecParser<A>String parser monad and full parser combinators library
ParsecParser<I, O>Parser monad that can work with any input stream type

Pretty

LocationFeatureDescription
CoreDoc<A>Produce nicely formatted text with smart layouts

Differencing

LocationFeatureDescription
CorePatch<EqA, A>Uses patch-theory to efficiently calculate the difference (Patch.diff(list1, list2)) between two collections of A and build a patch which can be applied (Patch.apply(patch, list)) to one to make the other (think git diff).

Traits

The traits are major feature of v5+ language-ext that makes generic programming with higher-kinds a reality. Check out Paul's series on Higher Kinds to get a deeper insight.

LocationFeatureDescription
CoreMonoidK<F>A monoid on applicative functors
CoreApplicative<F>Applicative functor
CoreEq<A>Ad-hoc equality trait
CoreFallible<F>Trait that describes types that can fail
CoreFoldable<T>Aggregation over a structure
CoreFunctor<F>Functor Map
CoreHas<M, TRAIT>Used in runtimes to enable DI-like capabilities
CoreHashable<A>Ad-hoc has-a-hash-code trait
CoreLocal<M, E>Creates a local environment to run a computation
CoreMonad<M>Monad trait
CoreMonadT<M, N>Monad transformer trait
CoreMonoid<A>A monoid is a type with an identity Empty and an associative binary operation +
CoreMonoidK<M>Equivalent of monoids for working on higher-kinded types
CoreMutates<M, OUTER_STATE, INNER_STATE>Used in runtimes to enable stateful operations
CoreOrd<A>Ad-hoc ordering / comparisons
CoreRange<SELF, NumOrdA, A>Abstraction of a range of values
CoreReadable<M, Env>Generalised Reader monad abstraction
CoreSemigroupK<F>A semigroup on functors
CoreSemigroup<A>Provides an associative binary operation +
CoreSemigroupK<M>Equivalent of semigroups for working with higher-kinded types
CoreStateful<M, S>Generalised State monad abstraction
CoreTraversable<T>Traversable structures support element-wise sequencing of Applicative effects
CoreWritable<M, W>Generalised Writer monad abstraction

Value traits

These work a little like NewType but they impart semantic meaning and some common operators for the underlying value.

LocationFeatureDescription
CoreDomainType<SELF, REPR>Provides a mapping from SELF to an underlying representation: REPR
CoreIdentifier <SELF>Identifiers (like IDs in databases: PersonId for example), they are equivalent to DomaintType with equality.
CoreVectorSpace<SELF, SCALAR>Scalable values; can add and subtract self, but can only multiply and divide by a scalar. Can also negate.
CoreAmount <SELF, SCALAR>Quantities, such as the amount of money in USD on a bank account or a file size in bytes. Derives VectorSpace, IdentifierLike, DomainType, and is orderable (comparable).
CoreLocusLike <SELF, SCALAR, DISTANCE>Works with space-like structures. Spaces have absolute and relative distances. Has an origin/zero point and derives DomainType, IdentifierLike, AmountLike and VectorSpace. DISTANCE must also be an AmountLike<SELF, REPR, SCALAR>.

Keywords

C#

FAQs

Package last updated on 08 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts