[darcs-devel] [patch1880] decouple RepoPatchV3 impl from NamedPrim

Ben Franksen bugs at darcs.net
Wed Aug 28 19:20:55 UTC 2019


Ben Franksen <ben.franksen at online.de> added the comment:

> So for example
> 
> if blah then Sealed ... else Sealed ...
> 
> means we have to evaluate blah.
> 
> And in general we can't just float those statically placed Sealeds
> upwards to be a single Sealed without messing up the use of witnesses,
> particularly because of NilFL.

This is true. And I guess since ghc's internal representation is typed
it would be true there, too. Though I wouldn't rely on it...

> That was really all I was trying to say, but I put it in a confusing way.

We are essentially in agreement, then. Good. :-)

>>   unseal seal x = seal (unsafeUnseal x)
>>                 = Sealed (unsafeUnseal x)
>>
>> This means (unseal seal) will /always/ return a Sealed, no matter what
>> the input is. Its result is already in WHNF and tehre is no reason to
>> evaluate any further. The implementation or sematics of unsafeUnseal is
>> irrelevant.
> 
> Yes, I agree with that. But it's useful to observe that it can only be
> implemented with something like unsafeCoercePEnd.

Sure. It still bugs me that we have to go through (unsafely) unpacking
and then repacking the Sealed here. I have tried lots of alternatives
but nothing works that isn't essentially the same as what we have now.
IMO the strictness restriction for pattern matching existentials (and
GADTs in general) is really annoying and I wish they would lift that. I
opened an issue here: https://gitlab.haskell.org/ghc/ghc/issues/17130

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1880>
__________________________________


More information about the darcs-devel mailing list