Skip to content

Repository files navigation

Pure.Primitives.Abstractions

Base interfaces for the Pure ecosystem — immutable, composable abstractions over .NET primitive types.

.NET build & testPlatforms compatibility checkBuild and DeployNuGetLicense: MIT

Overview

Pure.Primitives.Abstractions defines a set of minimal, read-only interfaces that represent primitive values. Each interface exposes only a getter — no mutation, no side effects. Complex types are built by composing simpler ones.

Interfaces

InterfaceNamespaceDescription
IBoolPure.Primitives.Abstractions.BoolBoolean value
ICharPure.Primitives.Abstractions.CharSingle character
IStringPure.Primitives.Abstractions.StringString value; implements IEnumerable<IChar>
INumber<T>Pure.Primitives.Abstractions.NumberGeneric numeric value; T : INumber<T>
IDatePure.Primitives.Abstractions.DateDate (day, month, year via INumber<ushort>)
ITimePure.Primitives.Abstractions.TimeTime (hour, minute, second, millisecond, microsecond, nanosecond)
IDateTimePure.Primitives.Abstractions.DateTimeComposition of IDate and ITime
IDayOfWeekPure.Primitives.Abstractions.DayOfWeekDay of week as a numeric value
IGuidPure.Primitives.Abstractions.GuidGUID value

Design Principles

  • Immutable — all interfaces expose only get properties; no setters, no methods that mutate state.
  • Composable — complex types inherit from simpler ones (IDateTime : IDate, ITime; IString : IEnumerable<IChar>).
  • GenericINumber<T> is covariant (out T) and constrained to System.Numerics.INumber<T>, supporting any numeric type.
  • AOT-compatible — the library is fully compatible with Native AOT compilation.

Target Frameworks

  • .NET 7
  • .NET 8
  • .NET 9
  • .NET 10

Installation

dotnet add package Pure.Primitives.Abstractions

Usage

Implement any interface to model an immutable primitive in your domain:

usingPure.Primitives.Abstractions.Number;publicsealedclassAge:INumber<ushort>{publicAge(ushortvalue)=>NumberValue=value;publicushortNumberValue{get;}}

Compose interfaces to build richer types:

usingPure.Primitives.Abstractions.DateTime;publicsealedclassBirthDateTime:IDateTime{// implement IDate and ITime members}

About

Base interfaces for the Pure ecosystem — immutable, composable abstractions over .NET primitive types; AOT-compatible.

Resources

Code of conduct

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages