Changelog for singletons-base-3.4
Changelog for the singletons-base project
3.4 [2024.05.12]
- Require building with GHC 9.10.
3.3 [2023.10.13]
-
Require building with GHC 9.8.
-
All singleton types with
SEqorSOrdinstances now haveEqorOrdinstances of the form:instance Eq (SExample a) where _ == _ = True instance Ord (SExample a) where compare _ _ = EQ -
Define
{P,S}Eqand{P,S}Ordinstances forSum,Product, andCompose. -
Define
TestEqualityandTestOrderinginstances forSSum,SProduct, andSCompose.
3.2 [2023.03.12]
-
Require building with GHC 9.6.
-
The kinds of the promoted
ErrorandErrorWithoutStackTracefunctions have been monomorphized toSymbol. A previous release generalized the kinds of these arguments to allow passing arguments besidesSymbols, but this change introduces ambiguity in derived code whenOverloadedStrings is enabled. See #89 for the full story.If you were relying on the previous, kind-polymorphic behavior of
Error, you can instead use the newData.Singletons.Base.PolyErrormodule that providesPolyError, a version ofErrorwith a kind-polymorphic argument. -
Data.Ord.SingletonsandData.Singletons.Base.THno longer define athenCmp :: Ordering -> Ordering -> Orderingfunction, as this is not something that has ever existed inbase. The existence of athenCmpfunction was solely motivated by the code generated by derivedOrdinstances, butsingletons-basenow uses(<>) @Orderinginstead. -
GHC.TypeLits.Singletonsnow re-exports theSChar,SNat, andSSymbolsingleton types offered byGHC.TypeLitsinbase-4.18.0.0rather than defining its own versions. The versions ofSChar,SNat, andSSymboloffered byGHC.TypeLitsare nearly identical, minus some minor cosmetic changes (e.g.,GHC.TypeLitsdefines pattern synonyms forSNatet a. instead of data constructors). -
GHC.TypeLits.Singletonsnow re-exports theSSymbolpattern synonym fromGHC.TypeLits.GHC.TypeLits.Singletonsalso continues to exportSSymfor backwards compatibility. -
Prelude.Singletonsnow re-exportsLiftA2andsLiftA2, mirroring the fact thatPreludenow re-exportsliftA2inbase-4.18.0.0. -
Provide
TestEqualityandTestCoercioninstances forSNat,SSymbol, andSChar`.
3.1.1 [2022.08.23]
- Require building with GHC 9.4.
3.1 [2021.10.30]
-
Require building with GHC 9.2.
-
singletons-basenow supports type-levelChars, a feature added in GHC 9.2. In particular:- Promoting and singling character literal expressions (e.g.,
f = 'a') is now supported. Promoting (but not singling) character patterns (e.g.,g 'a' = ()) is also supported. GHC.TypeLits.Singletonsnow offers singled versions of theConsSymbol,UnconsSymbol,CharToNat, andNatToChartype families that were introduced toGHC.TypeLitsin GHC 9.2.Text.Show.Singletonsnow makes use of type-levelChars, a feature added in GHC 9.2. As a result, there is no longer any need for theSChartype synonym, so it has been removed.- The
PShowandSShowinstances forSymbolnow display escape characters properly rather than returning the inputSymbolunchanged.
- Promoting and singling character literal expressions (e.g.,
-
In GHC 9.2,
Natis now a synonym forNatural. As a result, the bogusNum,Eq,Ord,Enum, andShowinstances forNatinGHC.TypeLits.Singletonshave been removed, as they have replaced by the corresponding instances forNatural. -
Add
Data.Functor.{Compose,Product,Sum}.Singletons. -
The types of various entities in
Data.Functor.Const.SingletonsandData.Proxy.Singletonshave been tweaked slightly such that their specificities match their term-level counterparts:-SConst :: forall {k} {a} {b :: k} (x :: a). Sing x -> Sing ('Const @a @b x) +SConst :: forall {k} a (b :: k) (x :: a). Sing x -> Sing ('Const @a @b x) -type ConstSym0 :: forall k a (b :: k). a ~> Const a b +type ConstSym0 :: forall {k} a (b :: k). a ~> Const a b -type ConstSym1 :: forall k a (b :: k). a -> Const a b +type ConstSym1 :: forall {k} a (b :: k). a -> Const a b -type ProxySym0 :: forall k (t :: k). Proxy t +type ProxySym0 :: forall {k} (t :: k). Proxy t -
Define instances of
SingI1andSingI2when possible.
3.0 [2021.03.12]
-
The
singletonslibrary has been split into three libraries:- The new
singletonslibrary is now a minimal library that only providesData.Singletons,Data.Singletons.Decide,Data.Singletons.Sigma, andData.Singletons.ShowSing(if compiled with GHC 8.6 or later).singletonsnow supports building GHCs back to GHC 8.0, as well as GHCJS. - The
singletons-thlibrary defines Template Haskell functionality for promoting and singling term-level definitions, but but nothing else. This library continues to require the latest stable release of GHC. - The
singletons-baselibrary defines promoted and singled versions of definitions from thebaselibrary, including thePrelude. This library continues to require the latest stable release of GHC.
Consult the changelogs for
singletonsandsingletons-thfor changes specific to those libraries. For more information on this split, see the relevant GitHub discussion. - The new
-
Require building with GHC 9.0.
-
The modules in
singletons-basehave been renamed to better reflect the modules frombasefrom which they take inspiration. In particular, the following module renamings have been applied:Data.Singletons.CustomStar->Data.Singletons.Base.CustomStarData.Singletons.Prelude->Prelude.SingletonsData.Singletons.Prelude.Applicative->Control.Applicative.SingletonsData.Singletons.Prelude.Bool->Data.Bool.SingletonsData.Singletons.Prelude.Const->Data.Functor.Const.SingletonsData.Singletons.Prelude.Either->Data.Either.SingletonsData.Singletons.Prelude.Enum->Data.Singletons.Base.EnumData.Singletons.Prelude.Eq->Data.Eq.SingletonsData.Singletons.Prelude.Foldable->Data.Foldable.SingletonsData.Singletons.Prelude.Function->Data.Function.SingletonsData.Singletons.Prelude.Functor->Data.Functor.Const.SingletonsData.Singletons.Prelude.Identity->Data.Functor.Identity.SingletonsData.Singletons.Prelude.IsString->Data.String.SingletonsData.Singletons.Prelude.Ord->Data.Ord.SingletonsData.Singletons.Prelude.List->Data.List.SingletonsData.Singletons.Prelude.List.NonEmpty->Data.List.NonEmpty.SingletonsData.Singletons.Prelude.Maybe->Data.Maybe.SingletonsData.Singletons.Prelude.Monad->Control.Monad.SingletonsData.Singletons.Prelude.Monad.Fail->Control.Monad.Fail.SingletonsData.Singletons.Prelude.Monad.Zip->Control.Monad.Zip.SingletonsData.Singletons.Prelude.Monoid->Data.Monoid.SingletonsData.Singletons.Prelude.Proxy->Data.Proxy.SingletonsData.Singletons.Prelude.Semigroup->Data.Semigroup.SingletonsData.Singletons.Prelude.Show->Data.Show.SingletonsData.Singletons.Prelude.Traversable->Data.Traversable.SingletonsData.Singletons.Prelude.Tuple->Data.Tuple.SingletonsData.Singletons.Prelude.Void->Data.Void.SingletonsData.Singletons.TH->Data.Singletons.Base.THData.Singletons.TypeError->Data.Singletons.Base.TypeErrorData.Singletons.TypeLits->GHC.TypeLits.SingletonsData.Singletons.TypeRepTYPE->Data.Singletons.Base.TypeRepTYPE
Note that modules that do not correspond to any particular module in
basenow have the prefixData.Singletons.Base.*. This includesData.Singletons.Base.Enum, a special module that exists to provide a home for theSuccandPredpromoted type families that is separate fromPrelude.Singletons(which exports everything fromPEnumexceptSuccandPred). This is done in an effort to make importingPrelude.Singletonsless likely to induce name clashes with code that works over unary natural numbers, which often use the names "Succ" and "Pred". -
An effort has been made to make the API of
Prelude.Singletonsmore closely mirror that of thePreludeinbase. As a result,Prelude.Singletonsnow exports some different functions than it used to. In particular, it now exports the following:Until/sUntil/UntilSym{N}type (++@#@$$$)type (.@#@$$$$)FlipSym3type (!!)/(%!!)/type (!!@#@{$})Length/sLength/LengthSym{N}DropWhile/sDropWhileLookupSym{N}Unzip3Sym{N}
Prelude.Singletonsalso used to export some things that were not exported by thePrelude. Accordingly, these exports have been removed fromPrelude.Singletons. They are:(^)/(%^)/type (^@#@{$}). Although thePreludedoes define a function named(^), it is more general than the one defined insingletons-base, which only works onNats. ImportGHC.TypeLits.Singletonsif you wish to use theNat-specific versions.DefaultEq, which has no counterpart in thePrelude. ImportData.Eq.Singletonsif you wish to use this.bool_, which has no counterpart in thePrelude. ImportData.Bool.Singletonsif you wish to use this.
-
Two previously public-facing modules—
Data.Singletons.Prelude.BaseandData.Singletons.Prelude.Num—have been turned into internal modules. The contents of these modules are re-exported fromPrelude.Singletons, so that can be used instead. -
Due to the
singletonspackage split, theEq,Ord, etc. instances forSomeSingare no longer provided in theData.Singletonsmodule in thesingletonslibrary. Instead, they are now provided in a newData.Singletons.Base.SomeSingmodule, which definesEq,Ord, etc. instances forSomeSingas orphans. -
The
PEqclass no longer usesDefaultEqas its default implementation for(==).DefaultEq, despite its name, is actually not a suitable implementation for(==)for a good majority of singleton types (see the discussion in this GitHub issue for more information).(==)'s default is now defined in terms of(/=), just like its term-level counterpart in theEqclass. -
Since
base-4.15.0.0now deprecatesData.Singletons.Option(in anticipation of its removal in a future version ofbase), this library no longer offers a singleton type forOption. Accordingly, theoption_function has also been removed.