Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHC 9.2 checklist #477

Closed
5 tasks done
RyanGlScott opened this issue Oct 14, 2020 · 1 comment
Closed
5 tasks done

GHC 9.2 checklist #477

RyanGlScott opened this issue Oct 14, 2020 · 1 comment

Comments

@RyanGlScott
Copy link
Collaborator

RyanGlScott commented Oct 14, 2020

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 for Natural, we no longer need to define the following bogus instances for Nat:

    -- | 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.
    instance Num Nat where
    (+) = 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
    instance Eq Nat where
    (==) = no_term_level_nats
    instance Ord Nat where
    compare = no_term_level_nats
    instance Enum Nat where
    toEnum = no_term_level_nats
    fromEnum = no_term_level_nats
    enumFromTo = no_term_level_nats
    enumFromThenTo = no_term_level_nats
    instance Show Nat where
    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.

  • 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 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.

@RyanGlScott
Copy link
Collaborator Author

I've uploaded the following to Hackage:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant