Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,393
    • Issues 4,393
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 376
    • Merge Requests 376
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #4355

Closed
Open
Opened Sep 30, 2010 by maltem@trac-maltem

Coud not deduce (Typeable a) from context (Typeable a, …)

Attached is a module containing code from XMonadContrib that does not type-check anymore with ghc 7.0.1 rc1. I tried to strip the code somewhat down; at least it only depends on base and mtl. Here's the (somewhat irritating) error message:

tcBug.hs:50:30:
    Could not deduce (Typeable a)
      from the context (Typeable a, Show ts, HList ts a, LayoutClass l a)
      arising from a use of `fromMessage'
    Possible fix:
      add (Typeable a) to the context of the instance declaration
    In a stmt of a pattern guard for
                 an equation for `handleMessage':
        Just (Toggle t) <- fromMessage m
    In an equation for `handleMessage':
        handleMessage mt m
          | Just (Toggle t) <- fromMessage m,
            i@(Just _) <- find (transformers mt) t
          = case currLayout mt of {
              EL l det
                -> do { l' <- fromMaybe l
                            `fmap`
                              handleMessage l (SomeMessage ReleaseResources);
                        .... }
                where
                    cur = (i == currIndex mt) }
          | otherwise
          = case currLayout mt of {
              EL l det
                -> fmap (fmap (\ x -> mt {currLayout = EL x det}))
                 $ handleMessage l m }
    In the instance declaration for `LayoutClass (MultiToggle ts l) a'

tcBug.hs:51:25:
    Could not deduce (HList ts a)
      from the context (Typeable a,
                        Show ts,
                        HList ts a,
                        LayoutClass l a,
                        Transformer t a)
      arising from a use of `find'
    Possible fix:
      add (HList ts a) to the context of
        the data constructor `Toggle'
        or the instance declaration
    In a stmt of a pattern guard for
                 an equation for `handleMessage':
        i@(Just _) <- find (transformers mt) t
    In a stmt of a pattern guard for
                 an equation for `handleMessage':
        Just (Toggle t) <- fromMessage m
    In an equation for `handleMessage':
        handleMessage mt m
          | Just (Toggle t) <- fromMessage m,
            i@(Just _) <- find (transformers mt) t
          = case currLayout mt of {
              EL l det
                -> do { l' <- fromMaybe l
                            `fmap`
                              handleMessage l (SomeMessage ReleaseResources);
                        .... }
                where
                    cur = (i == currIndex mt) }
          | otherwise
          = case currLayout mt of {
              EL l det
                -> fmap (fmap (\ x -> mt {currLayout = EL x det}))
                 $ handleMessage l m }
Trac metadata
Trac field Value
Version 7.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
7.0.1
Milestone
7.0.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#4355