a reliable way of dropping levity args?

Richard Eisenberg eir at cis.upenn.edu
Fri Jan 29 03:07:41 UTC 2016

Levity is very simple:

> data Levity = Lifted | Unlifted

And that's it, as far as Levity is concerned. The weird thing is TYPE, whose type is Levity -> TYPE 'Lifted. (Yes. TYPE's type mentions TYPE.) The * of yore is now spelled TYPE 'Lifted. The # of yore is now spelled TYPE 'Unlifted. * and # really are just type synonyms. (See them for yourself in GHC.Types.hs.)

There is some discussion on wiki:NoSubKinds, but it may be a bit out of date.

And, yes, a more obvious function to drop levity arguments (to unboxed tuples, presumably) is a good idea.


On Jan 28, 2016, at 8:30 PM, Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:

> Ahh, levity is type of kinds, right? For some reason I thought kinds are now
> levities (or whatever it's called). This makes sense. I just tried and I think
> it works, thanks.
> 2016-01-28 19:39 GMT-05:00 Richard Eisenberg <eir at cis.upenn.edu>:
>> On Jan 28, 2016, at 5:48 PM, Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:
>>>   | Just (tc, args) <- splitTyConApp_maybe ty
>>>   , isUnboxedTupleTyCon tc
>>>   = pprTrace "elimUbxSumRepTypes"
>>>       (text "orig args:" <+> ppr args $$
>>>        text "dropWhile isLevityTy args = " <+> ppr (dropWhile
>>> isLevityTy args)) $
>>>     concatMap go (drop (length args `div` 2) args)
>> You want (dropWhile (isLevityTy . typeKind) args). isLevityTy simply checks if its argument is exactly `Levity`.
>> Does that work?
>> Richard

More information about the ghc-devs mailing list