constrained-some 0.1.0.0 → 0.1.1
raw patch · 3 files changed
+19/−4 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Some.Constraint: instance GHC.Show.Show (Data.Some.Constraint.Somes (GHC.Show.Show : cs))
+ Data.Some.Constraint: instance GHC.Show.Show (Data.Some.Constraint.Somes cs) => GHC.Show.Show (Data.Some.Constraint.Somes (c : cs))
- Data.Some.Constraint: type Some1 ca cf = Somes1 '[ca] '[cf]
+ Data.Some.Constraint: type Some1 cf ca = Somes1 '[cf] '[ca]
Files
- CHANGELOG.md +6/−1
- constrained-some.cabal +1/−1
- src/Data/Some/Constraint.hs +12/−2
CHANGELOG.md view
@@ -6,7 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PVP versioning](https://pvp.haskell.org/). -## Initial release: v0.0.1 _(2024-11-27)_+## 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`
constrained-some.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: constrained-some-version: 0.1.0.0+version: 0.1.1 synopsis: Existential type that can be constrained description: 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 the package some.
src/Data/Some/Constraint.hs view
@@ -1,10 +1,14 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE QuantifiedConstraints #-} {-# LANGUAGE StandaloneKindSignatures #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE GADTs #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ScopedTypeVariables #-} module Data.Some.Constraint where @@ -51,4 +55,10 @@ (AllC csf f, AllC csa a) => f a -> Somes1 csf csa -- | Alias for 'Somes1' with just one 'Constraint'.-type Some1 ca cf = Somes1 '[ca] '[cf]+type Some1 cf ca = Somes1 '[cf] '[ca]++instance {-# OVERLAPPING #-} Show (Somes (Show ': cs)) where+ showsPrec d (Some x) = showParen (d > 10) $ showString "Some " . showsPrec 11 x++instance {-# OVERLAPPABLE #-} Show (Somes cs) => Show (Somes (c ': cs)) where+ showsPrec d (Some x) = showsPrec d (Some @cs x)