Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • 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,830
    • Issues 4,830
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13872

Closed
Open
Created Jun 24, 2017 by Ryan Scott@RyanGlScottMaintainer

Strange Typeable error message involving TypeInType

I originally discovered this when tinkering with #13871 (closed). This program:

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Foo where

import Data.Kind
import Data.Typeable

data Foo (a :: Type) (b :: Type) where
  MkFoo :: (a ~ Int, b ~ Char) => Foo a b

data family Sing (a :: k)
data SFoo (z :: Foo a b) where
  SMkFoo :: SFoo MkFoo

f :: String
f = show $ typeOf SMkFoo

Fails in GHC 8.0.1, 8.0.2, and 8.2 (after applying D3671) with a rather unsightly error message:

GHCi, version 8.3.20170624: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Foo              ( Foo.hs, interpreted )

Foo.hs:19:12: error:
    • No instance for (Typeable <>) arising from a use of ‘typeOf’
    • In the second argument of ‘($)’, namely ‘typeOf SMkFoo’
      In the expression: show $ typeOf SMkFoo
      In an equation for ‘f’: f = show $ typeOf SMkFoo
   |
19 | f = show $ typeOf SMkFoo
   |            ^^^^^^^^^^^^^

I'm not sure what this mysterious <> is, but I'm pretty sure it shouldn't be making an appearance here. (See also #13780 (closed), where <> also makes a surprise guest appearance.)

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
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