Skip to content
GitLab
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 5,247
    • Issues 5,247
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 574
    • Merge requests 574
  • 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 CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #10770
Closed
Open
Issue created Aug 12, 2015 by Neil Mitchell@ndmitchellReporter

Typeable solver has strange effects

Given:

import Data.Typeable

main = print $ foo $ Just ()

foo :: Typeable (t a) => t a -> String
foo x = let k = show $ typeOf x in k

I get:

TypeableInfer.hs:7:24:
    Could not deduce (Typeable t) arising from a use of `typeOf'
    from the context (Typeable (t a))
      bound by the type signature for
                 foo :: Typeable (t a) => t a -> String
      at TypeableInfer.hs:6:8-38
    In the second argument of `($)', namely `typeOf x'
    In the expression: show $ typeOf x
    In an equation for `k': k = show $ typeOf x

However, the error goes away with the minor modification of:

foo x = show $ typeOf x
Trac metadata
Trac field Value
Version 7.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ndmitchell@gmail.com
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