refactor: give glossaryTerms better type
This commit is contained in:
parent
0c37cbff64
commit
383d709620
@ -16,7 +16,7 @@ glossaryTerms :: FilePath -> Q Exp
|
|||||||
glossaryTerms basename = do
|
glossaryTerms basename = do
|
||||||
translationsAvailable <- i18nWidgetFilesAvailable' basename
|
translationsAvailable <- i18nWidgetFilesAvailable' basename
|
||||||
let terms = Map.mapWithKey (\k _ -> "Msg" <> unPathPiece k) translationsAvailable
|
let terms = Map.mapWithKey (\k _ -> "Msg" <> unPathPiece k) translationsAvailable
|
||||||
[e|Map.fromList $(listE . map (\(int, msg) -> tupE [litE . stringL $ repack int, conE $ mkName msg]) $ Map.toList terms)|]
|
[e|Map.fromList $(listE . map (\(int, msg) -> tupE [litE . stringL $ repack int, [e|SomeMessage $(conE $ mkName msg)|]]) $ Map.toList terms)|]
|
||||||
where
|
where
|
||||||
unPathPiece :: Text -> String
|
unPathPiece :: Text -> String
|
||||||
unPathPiece = repack . mconcat . map (over _head Char.toUpper) . Text.splitOn "-"
|
unPathPiece = repack . mconcat . map (over _head Char.toUpper) . Text.splitOn "-"
|
||||||
|
|||||||
Reference in New Issue
Block a user