paf31 / purescript-derive-lenses

A little utility to derive lenses and prisms for data types in PureScript
MIT License
41 stars 3 forks source link

Options to add additional imports for the output module #11

Closed sectore closed 7 years ago

sectore commented 7 years ago

Options to generate additional imports for the output module:

--moduleImports               "List of additional imports for the output module "

An example is added to README.

Update 02/03/2017: Remove need of --moduleImportsDelimiter Thx @alexbiehl for the hint!

paf31 commented 7 years ago

Thanks, the code looks great. But, why would you need to add additional imports? Isn't the default list complete?

sectore commented 7 years ago

In the following example import Bar would not be generated.

module Data.Tree where

import Bar

type Foo = {bar :: Bar}

Maybe there is a better approach reading imports from the original module (in this case Data.Tree) and add these to the output module (Data.Tree.Lenses) instead of adding these by using an extra option... Does have Language.PureScript any functions to read all imports of a module?

paf31 commented 7 years ago

It should be easy enough to list imports by parsing the module, but I understand the issue now, and I think this will work fine.

Thanks!