Opened 11 months ago

Closed 9 months ago

Last modified 8 months ago

#15816 closed bug (fixed)

Visible kind applications + data family: `U :: Type' said to be of kind `k0 -> k1` in error message

Reported by: Iceland_jack Owned by:
Priority: normal Milestone: 8.8.1
Component: Compiler Version: 8.6.1
Keywords: TypeApplications Cc: mnguyen
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_fail/T15816
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D5229
Wiki Page:

Description

Using the visible kind applications (D5229) (#12045) patch.

GHC erroneously calls U :: Type a "function" of kind k0 -> k1 if I understand this right,

$ ghci 
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/  :? for help
Prelude> :set prompt "> "
> import Data.Kind (Type)
>
> :set -XTypeFamilies 
> :set -XTypeApplications
>
> data family   U      :: Type
> data instance U @Int

<interactive>:7:1: error:
    • Cannot apply function of kind ‘k0 -> k1’
      to visible kind argument ‘Int’
    • In the data instance declaration for ‘U’
> 

I expect something like "Cannot apply type U to visible kind argument Int" or

> data instance U Int = MkU

<interactive>:7:1: error:
    • Expected kind ‘* -> *’, but ‘U’ has kind ‘*’
    • In the data instance declaration for ‘U’
> 

Change History (3)

comment:1 Changed 11 months ago by goldfire

Cc: mnguyen added

This one looks like a legit bug.

comment:2 Changed 9 months ago by RyanGlScott

Differential Rev(s): Phab:D5229
Milestone: 8.8.1
Resolution: fixed
Status: newclosed
Test Case: typecheck/should_fail/T15816

This was fixed in 17bd163566153babbf51adaff8397f948ae363ca:

Author: mynguyen <mnguyen1@brynmawr.edu>
Date:   Tue Dec 18 11:52:26 2018 -0500

    Visible kind application
    
    Summary:
    This patch implements visible kind application (GHC Proposal 15/#12045), as well as #15360 and #15362.
    It also refactors unnamed wildcard handling, and requires that type equations in type families in Template Haskell be
    written with full type on lhs. PartialTypeSignatures are on and warnings are off automatically with visible kind
    application, just like in term-level.
    
    There are a few remaining issues with this patch, as documented in
    ticket #16082.
    
    Includes a submodule update for Haddock.
    
    Test Plan: Tests T12045a/b/c/TH1/TH2, T15362, T15592a
    
    Reviewers: simonpj, goldfire, bgamari, alanz, RyanGlScott, Iceland_jack
    
    Subscribers: ningning, Iceland_jack, RyanGlScott, int-index, rwbarton, mpickering, carter
    
    GHC Trac Issues: `#12045`, `#15362`, `#15592`, `#15788`, `#15793`, `#15795`, `#15797`, `#15799`, `#15801`, `#15807`, `#15816`
    
    Differential Revision: https://phabricator.haskell.org/D5229

comment:3 Changed 8 months ago by Richard Eisenberg <rae@…>

In 17bd1635/ghc:

Visible kind application

Summary:
This patch implements visible kind application (GHC Proposal 15/#12045), as well as #15360 and #15362.
It also refactors unnamed wildcard handling, and requires that type equations in type families in Template Haskell be
written with full type on lhs. PartialTypeSignatures are on and warnings are off automatically with visible kind
application, just like in term-level.

There are a few remaining issues with this patch, as documented in
ticket #16082.

Includes a submodule update for Haddock.

Test Plan: Tests T12045a/b/c/TH1/TH2, T15362, T15592a

Reviewers: simonpj, goldfire, bgamari, alanz, RyanGlScott, Iceland_jack

Subscribers: ningning, Iceland_jack, RyanGlScott, int-index, rwbarton, mpickering, carter

GHC Trac Issues: `#12045`, `#15362`, `#15592`, `#15788`, `#15793`, `#15795`, `#15797`, `#15799`, `#15801`, `#15807`, `#15816`

Differential Revision: https://phabricator.haskell.org/D5229
Note: See TracTickets for help on using tickets.