MIT licensed by Julian Bruder
Maintained by [email protected]
This version can be pinned in stack with:constrained-some-0.1.3@sha256:e31166e69f3635a3e2348c3b9bfbdb522dc2aa3850135ff4bef09ba5f8576ecf,1464

Module documentation for 0.1.3

Depends on 1 package(full list with versions):

Hackage Static Badge Haskell-CI License: GPL v3

constrained-some

This library provides utilities for working with existential types and type-level constraints. It allows you to enforce multiple constraints on polymorphic types and containers complementing some.

Core

  • Existential types: Somes and Somes1 provide existential wrappers for types with multiple constraints.
  • Convenient aliases: Simplified types Some and Some1 for scenarios where just one constraint is needed.
  • More convenient aliases: Simplified types SomeF and SomesF for scenarios where the container of a Somes1 is known.
  • Natural transformations with constraints
    • mapSome :: (forall a. AllC csa a => f a -> g a) -> SomesF f csa -> SomesF g csa
    • traverseSome :: Functor m => (forall a. AllC csa a => f a -> m (g a)) -> SomesF f csa -> m (SomesF g csa)

Usage

import Data.Some.Constraint

someShowableOrd :: Somes '[Show, Ord]
someShowableOrd = Some [1, 2, 3 :: Int]

someNumFunctor :: Some1 Functor Num
someNumFunctor = Some1 [1, 2, 3 :: Int]

someListShowable :: SomeF [] Show
someListShowable = Some1 [1, 2, 3 :: Int]

Contact information

Contributions, critics and bug reports are welcome!

Please feel free to contact me through GitHub.

Changes

Changelog

All notable changes to the constrained-some library will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to PVP versioning.

v0.1.3 (2026-07-29)

Added

  • Support ghc-9.12 and ghc-9.14 (#5)

v0.1.2 (2024-11-29)

Added

  • Added type aliases SomesF and SomeF for existentials with fixed containers
  • Added mapSome with infix (<~$>) and traverseSome with infix (<~*>)

v0.1.1 (2024-11-29)

Added

  • Added instance Show (Somes cs) if cs contains Show

Initial release: v0.1.0 (2024-11-27)

Added

  • Existentials Somes and Somes1