How to implement type-level list concatenation as a GHC primitive type family

Iavor Diatchki iavor.diatchki at gmail.com
Sat Aug 10 14:48:33 UTC 2024


I'd say the main reason to implement `append` in GHC would be to handle
rules that can't be solved by evaluation (e.g., eliminate append [] on the
right, some associativity rule, etc.).

The speed of evaluation shouldn't really be much different as it should be
doing the same thing, more or less.

If there is a big performance hit for just straight evaluation, it might be
better to work on that part of GHC, which would also benefit other
functions, rather than adding more special cased functions.

Cheers,
Iavor

On Tue, Jul 2, 2024, 3:30 PM Hécate via ghc-devs <ghc-devs at haskell.org>
wrote:

> Hi GHC devs,
>
> I was wondering recently, considering that type family evaluation is
> notoriously slow, how one would implement type-level list concatenation
> directly within GHC in a way that is much less expensive to run. So I am
> looking for pointers, as this part of GHC is fairly unknown to me.
>
> Thinking about it, I'm actually unsure where the tyfam evaluation is
> happening.
>
> Any advice would be appreciated.
>
> Cheers,
> Hécate
>
> --
> Hécate ✨
> 🐦: @TechnoEmpress
> IRC: Hecate
> WWW: https://glitchbra.in
> RUN: BSD
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20240810/e6b9a6f6/attachment.html>


More information about the ghc-devs mailing list