PROPOSAL: Make Data.Type.Bool.If polykinded

Merijn Verstraaten merijn at inconsistent.nl
Mon Sep 1 21:41:33 UTC 2014


Ola!

Currently we have:

type family If cond tru fls where
    If True tru fls = tru
    If False tru fls = fls

Unfortunately, this appears to turned into a monomorphicly kinded type family by GHC, which means it’s impossible to do

foo :: If cond () (“Condition does not hold” ~ “”) => Foo -> Bar

or similar fancy constraints.

I hereby propose altering If to:

type family If (cond :: Bool) (tru :: k) (fls :: k) :: k where
   If True tru fls = tru
   If False tru fls = fls

Allowing it to work with kinds other than *.

Discussion period: 2 weeks? Seems like a minor change.

Cheers,
Merijn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140901/ceca2052/attachment.sig>


More information about the ghc-devs mailing list