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,250
    • Issues 5,250
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 561
    • Merge requests 561
  • 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
  • #4355
Closed
Open
Issue created 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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking