Changelog for singletons-base-3.3
Changelog for the singletons-base
project
3.3 [2023.10.13]
-
Require building with GHC 9.8.
-
All singleton types with
SEq
orSOrd
instances now haveEq
orOrd
instances of the form:instance Eq (SExample a) where _ == _ = True instance Ord (SExample a) where compare _ _ = EQ
-
Define
{P,S}Eq
and{P,S}Ord
instances forSum
,Product
, andCompose
. -
Define
TestEquality
andTestOrdering
instances forSSum
,SProduct
, andSCompose
.
3.2 [2023.03.12]
-
Require building with GHC 9.6.
-
The kinds of the promoted
Error
andErrorWithoutStackTrace
functions have been monomorphized toSymbol
. A previous release generalized the kinds of these arguments to allow passing arguments besidesSymbol
s, but this change introduces ambiguity in derived code whenOverloadedString
s 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.PolyError
module that providesPolyError
, a version ofError
with a kind-polymorphic argument. -
Data.Ord.Singletons
andData.Singletons.Base.TH
no longer define athenCmp :: Ordering -> Ordering -> Ordering
function, as this is not something that has ever existed inbase
. The existence of athenCmp
function was solely motivated by the code generated by derivedOrd
instances, butsingletons-base
now uses(<>) @Ordering
instead. -
GHC.TypeLits.Singletons
now re-exports theSChar
,SNat
, andSSymbol
singleton types offered byGHC.TypeLits
inbase-4.18.0.0
rather than defining its own versions. The versions ofSChar
,SNat
, andSSymbol
offered byGHC.TypeLits
are nearly identical, minus some minor cosmetic changes (e.g.,GHC.TypeLits
defines pattern synonyms forSNat
et a. instead of data constructors). -
GHC.TypeLits.Singletons
now re-exports theSSymbol
pattern synonym fromGHC.TypeLits
.GHC.TypeLits.Singletons
also continues to exportSSym
for backwards compatibility. -
Prelude.Singletons
now re-exportsLiftA2
andsLiftA2
, mirroring the fact thatPrelude
now re-exportsliftA2
inbase-4.18.0.0
. -
Provide
TestEquality
andTestCoercion
instances forSNat,
SSymbol, and
SChar`.
3.1.1 [2022.08.23]
- Require building with GHC 9.4.
3.1 [2021.10.30]
-
Require building with GHC 9.2.
-
singletons-base
now supports type-levelChar
s, 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.Singletons
now offers singled versions of theConsSymbol
,UnconsSymbol
,CharToNat
, andNatToChar
type families that were introduced toGHC.TypeLits
in GHC 9.2.Text.Show.Singletons
now makes use of type-levelChar
s, a feature added in GHC 9.2. As a result, there is no longer any need for theSChar
type synonym, so it has been removed.- The
PShow
andSShow
instances forSymbol
now display escape characters properly rather than returning the inputSymbol
unchanged.
- Promoting and singling character literal expressions (e.g.,
-
In GHC 9.2,
Nat
is now a synonym forNatural
. As a result, the bogusNum
,Eq
,Ord
,Enum
, andShow
instances forNat
inGHC.TypeLits.Singletons
have 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.Singletons
andData.Proxy.Singletons
have 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
SingI1
andSingI2
when possible.
3.0 [2021.03.12]
-
The
singletons
library has been split into three libraries:- The new
singletons
library 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).singletons
now supports building GHCs back to GHC 8.0, as well as GHCJS. - The
singletons-th
library 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-base
library defines promoted and singled versions of definitions from thebase
library, including thePrelude
. This library continues to require the latest stable release of GHC.
Consult the changelogs for
singletons
andsingletons-th
for 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-base
have been renamed to better reflect the modules frombase
from which they take inspiration. In particular, the following module renamings have been applied:Data.Singletons.CustomStar
->Data.Singletons.Base.CustomStar
Data.Singletons.Prelude
->Prelude.Singletons
Data.Singletons.Prelude.Applicative
->Control.Applicative.Singletons
Data.Singletons.Prelude.Bool
->Data.Bool.Singletons
Data.Singletons.Prelude.Const
->Data.Functor.Const.Singletons
Data.Singletons.Prelude.Either
->Data.Either.Singletons
Data.Singletons.Prelude.Enum
->Data.Singletons.Base.Enum
Data.Singletons.Prelude.Eq
->Data.Eq.Singletons
Data.Singletons.Prelude.Foldable
->Data.Foldable.Singletons
Data.Singletons.Prelude.Function
->Data.Function.Singletons
Data.Singletons.Prelude.Functor
->Data.Functor.Const.Singletons
Data.Singletons.Prelude.Identity
->Data.Functor.Identity.Singletons
Data.Singletons.Prelude.IsString
->Data.String.Singletons
Data.Singletons.Prelude.Ord
->Data.Ord.Singletons
Data.Singletons.Prelude.List
->Data.List.Singletons
Data.Singletons.Prelude.List.NonEmpty
->Data.List.NonEmpty.Singletons
Data.Singletons.Prelude.Maybe
->Data.Maybe.Singletons
Data.Singletons.Prelude.Monad
->Control.Monad.Singletons
Data.Singletons.Prelude.Monad.Fail
->Control.Monad.Fail.Singletons
Data.Singletons.Prelude.Monad.Zip
->Control.Monad.Zip.Singletons
Data.Singletons.Prelude.Monoid
->Data.Monoid.Singletons
Data.Singletons.Prelude.Proxy
->Data.Proxy.Singletons
Data.Singletons.Prelude.Semigroup
->Data.Semigroup.Singletons
Data.Singletons.Prelude.Show
->Data.Show.Singletons
Data.Singletons.Prelude.Traversable
->Data.Traversable.Singletons
Data.Singletons.Prelude.Tuple
->Data.Tuple.Singletons
Data.Singletons.Prelude.Void
->Data.Void.Singletons
Data.Singletons.TH
->Data.Singletons.Base.TH
Data.Singletons.TypeError
->Data.Singletons.Base.TypeError
Data.Singletons.TypeLits
->GHC.TypeLits.Singletons
Data.Singletons.TypeRepTYPE
->Data.Singletons.Base.TypeRepTYPE
Note that modules that do not correspond to any particular module in
base
now have the prefixData.Singletons.Base.*
. This includesData.Singletons.Base.Enum
, a special module that exists to provide a home for theSucc
andPred
promoted type families that is separate fromPrelude.Singletons
(which exports everything fromPEnum
exceptSucc
andPred
). This is done in an effort to make importingPrelude.Singletons
less 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.Singletons
more closely mirror that of thePrelude
inbase
. As a result,Prelude.Singletons
now exports some different functions than it used to. In particular, it now exports the following:Until
/sUntil
/UntilSym{N}
type (++@#@$$$)
type (.@#@$$$$)
FlipSym3
type (!!)
/(%!!)
/type (!!@#@{$})
Length
/sLength
/LengthSym{N}
DropWhile
/sDropWhile
LookupSym{N}
Unzip3Sym{N}
Prelude.Singletons
also used to export some things that were not exported by thePrelude
. Accordingly, these exports have been removed fromPrelude.Singletons
. They are:(^)
/(%^)
/type (^@#@{$})
. Although thePrelude
does define a function named(^)
, it is more general than the one defined insingletons-base
, which only works onNat
s. ImportGHC.TypeLits.Singletons
if you wish to use theNat
-specific versions.DefaultEq
, which has no counterpart in thePrelude
. ImportData.Eq.Singletons
if you wish to use this.bool_
, which has no counterpart in thePrelude
. ImportData.Bool.Singletons
if you wish to use this.
-
Two previously public-facing modules—
Data.Singletons.Prelude.Base
andData.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
singletons
package split, theEq
,Ord
, etc. instances forSomeSing
are no longer provided in theData.Singletons
module in thesingletons
library. Instead, they are now provided in a newData.Singletons.Base.SomeSing
module, which definesEq
,Ord
, etc. instances forSomeSing
as orphans. -
The
PEq
class no longer usesDefaultEq
as 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 theEq
class. -
Since
base-4.15.0.0
now 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.