Skip to content

Instantly share code, notes, and snippets.

@joshcough
Created February 19, 2015 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcough/b6288738f1b3712d2294 to your computer and use it in GitHub Desktop.
Save joshcough/b6288738f1b3712d2294 to your computer and use it in GitHub Desktop.
statements needs these new arguments
:: HashMap Text (Set Global) -> -- all imported term names
HashMap Text (Set Global) -> -- all imported type names
...
-- we can 'resolve/filter' an import clause with something like:
resolveTermImports :: Monad m =>
Import Global -> -- the import, obvs
HashMap Text Global -> -- map of all the term globals in the module
HashMap Text Global -> -- appropriately filtered result
-- types are same as terms.
resolveTypeImports :: Monad m =>
Import Global ->
HashMap Text Global ->
HashMap Text Global
we need to save those maps for all of the import clauses in a module
and then we can union together the term maps with something like:
(HM.unionWith HS.union . fmap HS.Singleton) termMap
we do the same thing for the type maps, and we have the right argments for statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment