Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,866
    • Issues 4,866
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 459
    • Merge requests 459
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15793
Closed
Open
Created Oct 23, 2018 by Icelandjack@IcelandjackReporter

Type family doesn't reduce with visible kind application

If we un-comment f2

{-# Language RankNTypes       #-}
{-# Language TypeFamilies     #-}
{-# Language TypeApplications #-}
{-# Language PolyKinds        #-}

import Data.Kind

type family
  F1 (a :: Type) :: Type where
  F1 a = Maybe a

f1 :: F1 a
f1 = Nothing

type family
  F2 :: forall (a :: Type). Type where
  F2 @a = Maybe a

-- f2 :: F2 @a
-- f2 = Nothing

this program fails with

       • Couldn't match kind ‘forall a1. *’ with ‘* -> *’
         When matching types
           F2 :: forall a. *
           Maybe :: * -> *
         Expected type: F2
           Actual type: Maybe a
       • In the expression: Nothing
         In an equation for ‘f2’: f2 = Nothing
      |
   20 | f2 = Nothing
      |      ^^^^^^^
   Failed, no modules loaded.

It also succeeds replacing Nothing with undefined

f2 :: F2 @a
f2 = undefined
Trac metadata
Trac field Value
Version 8.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC mnguyen
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking