[GHC] #7642: Nullary type classes

GHC cvs-ghc at haskell.org
Thu Jan 31 12:59:11 CET 2013


#7642: Nullary type classes
-----------------------------+----------------------------------------------
Reporter:  shachaf           |          Owner:                         
    Type:  feature request   |         Status:  new                    
Priority:  normal            |      Component:  Compiler (Type checker)
 Version:  7.6.1             |       Keywords:                         
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple       
 Failure:  None/Unknown      |      Blockedby:                         
Blocking:                    |        Related:                         
-----------------------------+----------------------------------------------
 GHC supports `MultiParamTypeClasses` with two or more parameters, but it
 explicitly rejects classes with no parameters. There doesn't seem to be a
 good reason for that.

 Some example uses that came up in IRC:

 {{{
 isPrime :: RiemannHypothesis => Integer -> Bool

 unsafePerformIO :: Unsafe => IO a -> a
 }}}

 The main reason to allow it is probably that it's a pointless restriction,
 like EmptyDataDecls. In fact, the simplest implementation for this patch
 consists of deleting one line of code. The attached patch is slightly
 bigger because it also fixes error messages (I also included a detabbing
 patch).

 If necessary this can be made a separate `LANGUAGE` flag -- this patch
 just folds it into `MultiParamTypeClasses`.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7642>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list