Typelevel Symbol concatenation
Iavor Diatchki
iavor.diatchki at gmail.com
Tue Oct 25 23:15:48 UTC 2016
Hello Oleg,
nicely done! I wrote the `GHC.TypeLits` module, and the original plan was
that it should just provide the basics needed by the compiler, and other
libraries would define a nicer user-facing interface. So, with this in
mind, `AppendSymbol` makes a lot of sense to me. However, the original
plan didn't quite happen, and everyone seems to be using `GHC.TypeLits`
directly, so maybe picking a shorter name is a good idea.
To me, personally, `(<>)` and `(++)` look the nicest. I agree with you
that `(++)` might suggest that the arguments are type-level lists, which
they aren't. OTOH, `(<>)` looks a lot like `(:<>:)`, which is also
defined in `GHC.TypeLits` and is used for horizontal concatenation of error
messages.
Cheers,
-Iavor
On Tue, Oct 25, 2016 at 8:28 AM, Oleg Grenrus <oleg.grenrus at iki.fi> wrote:
> There is an issue #1216: "concatenation of type level symbols missing" [1].
>
> I made a working patch, but we need to figure out the details.
> As the patch introduces new non-obvious name to the base library, I’m
> starting a thread in libraries@ to figure out community's opinion.
>
> I’m proposing to add `type family (n :: Symbol) <> (m :: Symbol)` to
> `GHC.TypeLits`.
>
> Currently implementation uses (<>). Another options are (++), (+++) or
> `AppendSymbol`.
>
> - (<>) resembles Semigroup operation, as (+) resembles Num operation
> - (++) is a list appending operation. IMHO it’s a bad choice
> - (+++) is used by ghc-typelits-symbols plugin
> - `AppendSymbol` is sensible too, if libraries want to define own versions
> of type-level (<>) (e.g. polykinded)
>
> Discussion period: 2 weeks.
>
> Cheers,
> Oleg Grenrus.
>
> - [1] https://ghc.haskell.org/trac/ghc/ticket/12162
> - [2] https://github.com/konn/ghc-typelits-symbols/blob/
> cd812f4cfc2e6816a18283a6a0e9bb2d9ea2905e/src/GHC/TypeLits/
> Symbols/Internal.hs#L6-L8
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20161025/c08335f4/attachment.html>
More information about the Libraries
mailing list