Wildcards in type functions vs. named wild cards

Simon Peyton Jones simonpj at microsoft.com
Tue Dec 1 13:07:53 UTC 2015


Hmm.  I suppose that

  F _ = Int

should mean just the same as

  F a = Int

But what about 
 
  F _a = _a -> _a

Does that mean anything different from

  F a = a -> a

If F _a = .. is allowed at all, I guess it should mean just the same as an ordinary type variable.

Would you like to implement that, and document it?  (My wildcard refactoring patch is about to land.)

Simon

|  -----Original Message-----
|  From: Jan Stolarek [mailto:jan.stolarek at p.lodz.pl]
|  Sent: 01 December 2015 12:21
|  To: Simon Peyton Jones <simonpj at microsoft.com>
|  Cc: ghc-devs at haskell.org; Michał Sośnicki <180692 at edu.p.lodz.pl>
|  Subject: Wildcards in type functions vs. named wild cards
|  
|  Simon,
|  
|  One of my students (Michał, CCd) is hacking on #10982 and he noticed a
|  rather unexpected behaviour. If I say:
|  
|  {-# LANGUAGE TypeFamilies #-}
|  
|  module T10982 where
|  
|  type family F a where
|      F _t = Int
|  
|  Then everything is fine. But if I enable NamedWildCards extension then
|  suddenly this code is
|  rejected:
|  
|  T10982.hs:7:7: error:
|      Unexpected wild card: ‘_t’
|      In the declaration for type synonym ‘F’
|  
|  I am 99% sure this is a bug and the program should be accepted even
|  with NamedWildCards. Am I correct? Does this interact in any way with
|  your upcomming refactoring of wildcards?
|  
|  Janek
|  
|  ---
|  Politechnika Łódzka
|  Lodz University of Technology
|  
|  Treść tej wiadomości zawiera informacje przeznaczone tylko dla
|  adresata.
|  Jeżeli nie jesteście Państwo jej adresatem, bądź otrzymaliście ją
|  przez pomyłkę prosimy o powiadomienie o tym nadawcy oraz trwałe jej
|  usunięcie.
|  
|  This email contains information intended solely for the use of the
|  individual to whom it is addressed.
|  If you are not the intended recipient or if you have received this
|  message in error, please notify the sender and delete it from your
|  system.


More information about the ghc-devs mailing list