Created
September 12, 2017 11:20
-
-
Save puffnfresh/7f1532035b28674eccec1f218f46061e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
removeModName :: Name -> Name | |
removeModName = | |
filterModName (const False) | |
removeAllModNames :: Dec -> Dec | |
removeAllModNames = | |
transformOnOf (_SigD . _2) typeChildren (typeName %~ removeModName) . | |
transformOnOf (_ValD . _2 . bodyExp) expChildren (expName %~ removeModName) | |
simplify :: Dec -> Dec | |
simplify = | |
_SigD . _2 %~ removeEmptyForall | |
renderNoLength :: Ppr a => a -> String | |
renderNoLength = | |
HPJ.renderStyle (HPJ.style { HPJ.lineLength = maxBound }) . to_HPJ_Doc . ppr | |
simplifiedTH :: [Dec] -> ExpQ | |
simplifiedTH = | |
stringE . renderNoLength . fmap (simplify . removeAllModNames) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment