有没有关于如何使用DMap
类型的示例?软件包文档非常精通,如果仅供参考,我知道这一点,但它对入门毫无帮助。谷歌没有透露任何我能看到的信息。
发布于 2018-06-13 08:30:06
从Updated README.md example拉取请求。需要为GADT实现GEq
和GCompare
实例:
data Foo a where
AnInt :: Foo Int
AString :: Foo String
deriveGEq ''Foo
deriveGCompare ''Foo
dmap1 :: DMap Foo Identity
dmap1 = fromList [AnInt ==> 1, AString ==> "bar"]
main = do
print $ dmap1 ! AnInt
print $ dmap1 ! AString
https://stackoverflow.com/questions/44040082
复制相似问题