Restricted sums in BoxedRep

David Feuer david.feuer at gmail.com
Wed Oct 14 14:52:24 UTC 2020


Yes, I think you're getting the gist. Pattern matching with one or two
nulls is just an equality test or three. In practice, we'd want a fixed
number of evenly spaced nulls, allowing jump table techniques to be used
when there are more cases. We'd presumably have a hard limit for the number
of nulls a type is allowed to have.

On Wed, Oct 14, 2020, 10:29 AM Spiwack, Arnaud <arnaud.spiwack at tweag.io>
wrote:

> Ok, I believe get it now,
>
> Let's imagine (to take only the simplest case) that we have a `Nullable#
> a` type, such that `Nullable# a = (# (##) | a #)`. What would be the kind
> of `Nullable#`? I imagine that it would be something like `TYPE (BoxedRep
> Lifted) -> TYPE (BoxedRep Nullable)`.
>
> Then you would want to abstract the type of arrays/tvars/whatnot from
> `Type -> Type` to `forall r. TYPE (BoxRep r) -> Type`.
>
> Is that a correct interpretation of your suggestion?
>
> If so, my guess would be that all the above is fine, but I suspect (and
> I'm quite a bit out of my comfort zone here) that there can be considerable
> difficulties in implementing pattern-matching for such a type.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20201014/ad56c4aa/attachment.html>


More information about the ghc-devs mailing list