[Template-haskell] How to use Template Haskell build Map ?
Andy Stewart
lazycat.manatee at gmail.com
Tue Sep 8 03:13:28 EDT 2009
Hi all,
I have below instances:
instance PageViewState DiredViewState where
instance PageViewState StringViewState where
I can use Language.Haskell.Exts.Parser scan above instances got list:
typeList :: [Type]
typeList = [TyCon (UnQual (Ident "DiredViewState")),TyCon (UnQual (Ident "StringViewState"))]
So question is how to use Template Haskell and above `typeList` build
below `Map` at compile-time?
tagmap = M.fromList [(typeIdOf StringViewState, Exists (Dict :: PageViewStateDict StringViewState))
,(typeIdOf DiredViewState, Exists (Dict :: PageViewStateDict DiredViewState))]
Thanks!
-- Andy
More information about the template-haskell
mailing list