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,865
    • Issues 4,865
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 461
    • Merge requests 461
  • 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
  • #20514
Closed
Open
Created Oct 15, 2021 by David Feuer@treeowlReporter

Heterogeneous coercions

I noticed something annoying:

import GHC.Generics
import Data.Coerce
fun :: forall j k (a :: j) (b :: k). V1 a -> V1 b
fun = coerce

gives me

    • Couldn't match type ‘j’ with ‘k’ arising from a use of ‘coerce’
      ‘j’ is a rigid type variable bound by
        the type signature for:
          fun :: forall j k (a :: j) (b :: k). V1 a -> V1 b
        at <interactive>:8:1-49
      ‘k’ is a rigid type variable bound by
        the type signature for:
          fun :: forall j k (a :: j) (b :: k). V1 a -> V1 b
        at <interactive>:8:1-49
    • In the expression: coerce
      In an equation for ‘fun’: fun = coerce
    • Relevant bindings include
        fun :: V1 a -> V1 b (bound at <interactive>:8:52)

Ugh. Now obviously, this micro-example is easily handled by writing

fun = \case

instead, but in more interesting situations that's not an option.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking