, , String to Symbol?
String Symbol, , , Haskell . , , .
, GADT.
(, singletons):
data SSym :: Symbol -> * where
SSym :: KnownSymbol s => SSym s
-- defining values
sym1 = SSym :: SSym "foo"
sym2 = SSym :: SSym "bar"
Proxy KnownSymbol . , , :
extractString :: SSym s -> String
extractString s@SSym = symbolVal s
SSym, KnownSymbol. Proxy:
extractString' :: forall (s :: Symbol). Proxy s -> String
extractString' p@Proxy = symbolVal p
-- type error, we can't recover the string from anywhere
... SomeSymbol, , , .
SomeSymbol SSym, , , , . .
extractString'' :: SomeSymbol -> String
extractString'' (SomeSymbol proxy) = symbolVal proxy
, , , ( SSym -s, ).