Are there any examples anywhere of how to use the DMap
type? The package documentation is very learned, and I know it if for reference only, but it is singularly unhelpful for one getting started. Google reveals nothing that I can see.
Data.Dependent.Map examples
Asked Answered
From the Updated README.md example pull request. One need to implement GEq
and GCompare
instances for a GADT:
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
© 2022 - 2024 — McMap. All rights reserved.
DMap
will help you with? – UnderestimateDMap
is used very heavily inreflex
, so you can take a look at that package. – Clem