-
-
Save dminuoso/0da790d5ac72f0cfab1e451a306ca064 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
fixup :: AttrDef -> AttrDef | |
fixup attr@(AttrDef nam num ty opts) | |
| let nam = attr ^. attrNam | |
-- Only do this if the type is actually integer. | |
, TyExtra TyInteger _into _imp <- attr ^. attrTy | |
-- Check if the dictionary has values for this | |
-- attribute name. | |
, isJust (M.lookup nam enums) | |
-- Overwrite the name and set imported from to nothing | |
-- because the ADT will reside in the same module. | |
= attr & (attrTy % tyMappedInto) .~ nam | |
& (attrTy % tyImportedFrom) .~ [] | |
| otherwise | |
= attr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment