[GHC] #9607: Programs that require AllowAmbiguousTypes in 7.8

GHC ghc-devs at haskell.org
Wed Feb 25 08:23:12 UTC 2015


#9607: Programs that require AllowAmbiguousTypes in 7.8
-------------------------------------+-------------------------------------
        Reporter:  jstolarek         |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler (Type    |                 Version:  7.8.3
  checker)                           |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  GHC rejects       |               Test Case:
  valid program                      |                Blocking:
      Blocked By:                    |  Differential Revisions:
 Related Tickets:                    |
-------------------------------------+-------------------------------------

Comment (by jstolarek):

 I believe GHC is right to reject this program. Look at the type signature
 of `forwardingAction`:

 {{{#!hs
 forwardingAction :: forall a b c d trig metaCmd . ( Monoid c
                     , ServerAction metaCmd (a->c->d) d
                     , ClientAction VisCom trig (b->c) )
                  =>  (metaCmd -> a -> trig) -> (metaCmd -> b)
                  -> metaCmd -> a
                  -> ([VisCom],[VisResp] -> d, d -> ComResp metaCmd)
 }}}

 Note that the `c` type variable - the on GHC claims is ambiguous - appears
 only under type classes in the context. It does not appear in type of any
 argument nor the return type. This means that at the call site there might
 be no way to infer what type should the `c` variable be.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9607#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list