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

Give Compose's instances explicit kind signatures #607

Merged
merged 1 commit into from
Jun 19, 2024

Commits on Jun 18, 2024

  1. Give Compose's instances explicit kind signatures

    Previously, the promoted versions of certain `Compose` instances (`Functor`,
    `Foldable`, etc.) would be overly general due to the fact that `singletons-th`
    omits instance contexts during promotion. For example, the promoted `Functor`
    instance for `Compose` was:
    
    ```hs
    instance PFunctor (Compose (f :: k -> Type) (g :: Type -> k)) where ...
    ```
    
    But this was too general, as `f` and `g` should both be of kind `Type -> Type`
    instead. The defunctionalization symbols associated with the instances also had
    a similar problem.
    
    This patch annotates each instance with an explicit kind (e.g., `Functor
    (Compose (f :: Type -> Type) g)` to ensure that the promoted instances also
    have the intended kind. This is very much in the same spirit as the situation
    described in `Note [Using standalone kind signatures not present in the base
    library]` in `Control.Monad.Singletons.Internal`, but for instance declarations
    instead of class declarations.
    
    Resolves the "Overly polymorphic instance methods" section of #601.
    RyanGlScott committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    b40498c View commit details
    Browse the repository at this point in the history