diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2022-09-26 07:46:10 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2022-10-06 07:45:46 -0400 |
commit | 532de36870ed9e880d5f146a478453701e9db25d (patch) | |
tree | 4b9a08269df30acf561611df4b7d4d0df48318ce /compiler/GHC/Tc/Instance | |
parent | 8a31d02e0b76ea0d279f5c6d74239e6aa45ef631 (diff) | |
download | haskell-532de36870ed9e880d5f146a478453701e9db25d.tar.gz |
Export symbolSing, SSymbol, and friends (CLC#85)wip/clc-85
This implements this Core Libraries Proposal:
https://github.com/haskell/core-libraries-committee/issues/85
In particular, it:
1. Exposes the `symbolSing` method of `KnownSymbol`,
2. Exports the abstract `SSymbol` type used in `symbolSing`, and
3. Defines an API for interacting with `SSymbol`.
This also makes corresponding changes for `natSing`/`KnownNat`/`SNat` and
`charSing`/`KnownChar`/`SChar`. This fixes #15183 and addresses part (2)
of #21568.
Diffstat (limited to 'compiler/GHC/Tc/Instance')
-rw-r--r-- | compiler/GHC/Tc/Instance/Class.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Instance/Class.hs b/compiler/GHC/Tc/Instance/Class.hs index 2bac6fa3ab..0d96d4420e 100644 --- a/compiler/GHC/Tc/Instance/Class.hs +++ b/compiler/GHC/Tc/Instance/Class.hs @@ -571,15 +571,15 @@ Some further observations about `withDict`: (WD3) As an alternative to `withDict`, one could define functions like `withT` above in terms of `unsafeCoerce`. This is more error-prone, however. -(WD4) In order to define things like `reifySymbol` below: +(WD4) In order to define things like `withKnownNat` below: - reifySymbol :: forall r. String -> (forall (n :: Symbol). KnownSymbol n => r) -> r + withKnownNat :: SNat n -> (KnownNat n => r) -> r `withDict` needs to be instantiated with `Any`, like so: - reifySymbol n k = withDict @(KnownSymbol Any) @String @r n (k @Any) + withKnownNat = withDict @(KnownNat Any) @(SNat Any) @r - The use of `Any` is explained in Note [NOINLINE someNatVal] in + The use of `Any` is explained in Note [NOINLINE withSomeSNat] in base:GHC.TypeNats. (WD5) In earlier implementations, `withDict` was implemented as an identifier |