You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--| This bogus 'Num' instance is helpful for people who want to define
-- functions over Nats that will only be used at the type level or
-- as singletons. A correct SNum instance for Nat singletons exists.
instanceNumNatwhere
(+)= no_term_level_nats
(-)= no_term_level_nats
(*)= no_term_level_nats
negate= no_term_level_nats
abs= no_term_level_nats
signum= no_term_level_nats
fromInteger= no_term_level_nats
instanceEqNatwhere
(==)= no_term_level_nats
instanceOrdNatwhere
compare= no_term_level_nats
instanceEnumNatwhere
toEnum= no_term_level_nats
fromEnum= no_term_level_nats
enumFromTo= no_term_level_nats
enumFromThenTo= no_term_level_nats
instanceShowNatwhere
showsPrec= no_term_level_nats
Actually, it's less "we no longer need to define" and more "we cannot define". This is because Natural already has instances of Num, Eq, Ord, Enum, and Show, so defining instances for Nat (now a type synonym for Natural) will result in type errors. See this head.hackage MR for a rough sketch of a fix we can apply in singletons.
If we do this, we should make sure to update this section of the README, which claims that Nats need special care. This will no longer be true in GHC 9.2, so we should revise this documentation accordingly.
With the advent of GHC2021, many of the language extensions in this list can be dropped. On the other hand, we will need to explicitly disable some language extensions implied by GHC2021. One such extension is NamedWildCards. This poses issues when singling code like this:
f _x =()
This is because singletons will single it to the following code:
sF (_sx ::Sing_x) =STuple0
If NamedWildCards is enabled, then GHC will treat the _x in Sing _x as a wildcard instead of a variable name. We'd prefer it be a variable name, so we should disable NamedWildCards in the test suite and encourage users to do the same in the README.
Manually upload the Haddocks after uploading singletons-th/singletons-base to Hackage.
The text was updated successfully, but these errors were encountered:
This issue serves as a reminder to do certain things before we ship a new major release that supports GHC 9.2:
Now that
Nat
is a synonym forNatural
, we no longer need to define the following bogus instances forNat
:singletons/singletons-base/src/GHC/TypeLits/Singletons.hs
Lines 63 to 88 in 0261baf
Actually, it's less "we no longer need to define" and more "we cannot define". This is because
Natural
already has instances ofNum
,Eq
,Ord
,Enum
, andShow
, so defining instances forNat
(now a type synonym forNatural
) will result in type errors. See thishead.hackage
MR for a rough sketch of a fix we can apply insingletons
.If we do this, we should make sure to update this section of the
README
, which claims thatNat
s need special care. This will no longer be true in GHC 9.2, so we should revise this documentation accordingly.Now that characters can be promoted to the type level, a lot of the hacks currently used in
Text.Show.Singletons
ought to be revisited. See Use type-level characters in Text.Show.Singletons #487.Consider supporting type applications in patterns. See Allow promoting and singling of visible type applications in data constructor patterns #489.
With the advent of
GHC2021
, many of the language extensions in this list can be dropped. On the other hand, we will need to explicitly disable some language extensions implied byGHC2021
. One such extension isNamedWildCards
. This poses issues when singling code like this:This is because
singletons
will single it to the following code:If
NamedWildCards
is enabled, then GHC will treat the_x
inSing _x
as a wildcard instead of a variable name. We'd prefer it be a variable name, so we should disableNamedWildCards
in the test suite and encourage users to do the same in theREADME
.Manually upload the Haddocks after uploading
singletons-th
/singletons-base
to Hackage.The text was updated successfully, but these errors were encountered: