[GHC] #12162: Concatenation of type level symbols missing
GHC
ghc-devs at haskell.org
Tue Oct 25 21:24:44 UTC 2016
#12162: Concatenation of type level symbols missing
-------------------------------------+-------------------------------------
Reporter: augustss | Owner: phadej
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2632
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by ekmett):
If we build in
{{{#!hs
type family (++) :: Symbol -> Symbol -> Symbol
}}}
that doesn't prevent it from later being used in a potential later or even
third-party polykinded
{{{#!hs
type family (<>) :: k -> k -> k
type instance (<>) = (++)
}}}
and it would be consistent with the fact that the other `GHC.TypeLits`
such as `(+)` are all specific to one kind.
That said, none of the existing machinery for `KnownNat` knows anything
about `(+)`, so it'd be a leap to expect `KnownSymbol` to know about
`(++)`.
Also note that complicating evidence by giving it more internal hidden
constructors like is used to deal with `Coercible` instances is actually
bad for folks who use things like reflection to mimic this behavior or
construct symbols at runtime today.
As an aside, you can actually get type level symbol concatenation and
tools for working with it out of the `constraints` package at least in
HEAD today, but it doesn't have any compiler assistance. You have to
explicitly use the various axioms and `appendSymbol` proofs rather
explicitly to get the resulting `KnownSymbol` instances, but you can do
it.
https://github.com/ekmett/constraints/blob/master/src/Data/Constraint/Symbol.hs
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12162#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list