这有效:
{-# LANGUAGE DataKinds, PolyKinds, KindSignatures, GADTs #-}
import GHC.TypeLits
data F :: Symbol -> * where
F :: F s
unF :: SingI s => F s -> String
unF g = fromSing $ s g where
s :: SingI s => F s -> Sing s
s _ = sing
val :: F "val"
val = F
main = print $ unF val -->> "val"
我可以在没有嵌套函数的情况下编写unF吗?我一般都是这样做的吗?#34;对#34;?