Typelevel Symbol concatenation

Oleg Grenrus oleg.grenrus at iki.fi
Tue Oct 25 15:28:14 UTC 2016


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 <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 <https://github.com/konn/ghc-typelits-symbols/blob/cd812f4cfc2e6816a18283a6a0e9bb2d9ea2905e/src/GHC/TypeLits/Symbols/Internal.hs#L6-L8>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20161025/c0aa2296/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20161025/c0aa2296/attachment.sig>


More information about the Libraries mailing list