[GHC] #9587: Type checking with type functions introduces many type variables, which remain ambiguous. The code no longer type checks.

GHC ghc-devs at haskell.org
Mon Sep 15 12:40:58 UTC 2014


#9587: Type checking with type functions introduces many type variables, which
remain ambiguous. The code no longer type checks.
-------------------------------------+-------------------------------------
              Reporter:  oleg        |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
  (Type checker)                     |         Keywords:  type family,
            Resolution:              |  ambiguity check
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:  GHC         |       Blocked By:
  rejects valid program              |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I've tried this with GHC 7.6 and 7.4 as well as 7.8.3.  When compiling the
 code you give above, all of them say
 {{{
 T9587.hs:26:11:
     Could not deduce (Arr repr (Arr repr a4 a3) (Arr repr a4 b)
                       ~ Arr repr (Arr repr a2 a1) (Arr repr a2 b0))
     from the context (ESymantics repr,
                       Arr repr a3 a ~ Arr repr a4 a3,
                       Arr repr a b ~ Arr repr a4 a3)
       bound by the inferred type for `c3':
                  (ESymantics repr, Arr repr a3 a ~ Arr repr a4 a3,
                   Arr repr a b ~ Arr repr a4 a3) =>
                  repr (Arr repr (Arr repr a4 a3) (Arr repr a4 b))
       at T9587.hs:26:11-68
     NB: `Arr' is a type function, and may not be injective
     Expected type: repr (Arr repr (Arr repr a3 a) (Arr repr a3 b))
       Actual type: repr (Arr repr (Arr repr a2 a1) (Arr repr a2 b0))
     When checking that `c3'
       has the inferred type `forall (repr1 :: * -> *) b1 a4 a5 a6.
                              (ESymantics repr1, Arr repr1 a5 a4 ~ Arr
 repr1 a6 a5,
                               Arr repr1 a4 b1 ~ Arr repr1 a6 a5) =>
                              repr1 (Arr repr1 (Arr repr1 a6 a5) (Arr repr1
 a6 b1))'
     Probable cause: the inferred type is ambiguous
     In the expression:
       let c3 = lam (\ f -> lam (\ x -> ...))
       in (c3 `app` (lam (\ x -> x `add` int 14))) `app` (int 0)
 }}}
 So are you saying that something has changed?  If so, what?  Thanks

 Simon

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


More information about the ghc-tickets mailing list