[GHC] #14366: Type family equation refuses to unify wildcard type patterns

GHC ghc-devs at haskell.org
Thu Oct 19 10:46:34 UTC 2017


#14366: Type family equation refuses to unify wildcard type patterns
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.2.1
  checker)                           |             Keywords:  TypeFamilies,
      Resolution:                    |  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 These wildcards are more like wildards in types.  E.g
 {{{
 f :: _ -> _
 f x = x
 }}}
 Here `f` gets the infeerred type `f :: forall a. a -> a`, and both `_`
 holes are reported as standing for `a`.

 Similarly (untested) you can write wildcards in pattern signatures.  Thus:
 {{{
 f :: a -> (a -> Char -> Bool) -> Bool
 f x (g :: p -> _ -> _) = g (x :: p) 'v' :: Bool
 }}}
 Here the pattern tyupe `(p -> _ -> _)` gives the shepe of the type
 expected for `g`.  But the two underscores can certainly turn out to the
 same type.

 So I think yes, we should accept the Description.   I don't know how hard
 it'd be.

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


More information about the ghc-tickets mailing list