Ivan Lazar Miljenovic <ivan.miljeno...@gmail.com> writes: > On 17 September 2013 09:35, Evan Laforge <qdun...@gmail.com> wrote:
snip >> None of this is a big deal, but I'm curious about other's opinions on >> it. Are there strengths to the separate export list that I'm missing? > > I do like the actual "summary" aspect as you've noted, as I can at > times be looking through the actual code rather than haddock > documentation when exploring new code (or even trying to remember what > I wrote in old code). > The summary of functionality that the export list provides is a very nice feature that I often miss in other languages. That being said, it brings up a somewhat related issue that may become increasingly problematic with the rising use of libraries such as lens: exporting members defined by Template Haskell. While we have nice sugar for exporting all accessors of a record (MyRecord(..)), we have no way to do the same for analogous TH-generated members such as lenses. Instead, we require that the user laboriously list each member of the record, taking care not to forget any. One approach would be to simply allow TH to add exports as presented in Ticket #1475 [1]. I can't help but wonder if there's another way, however. One (questionable) option would be to allow globbing patterns in export lists. Another approach might be to introduce some notion of a name list which can appear in the export list. These lists could be built up by either user declarations in the source module or in Template Haskell splices and would serve as a way to group logically related exports. This would allow uses such as (excuse the terrible syntax), module HelloWorld ( namelist MyDataLenses , namelist ArithmeticOps ) where import Control.Lens data MyData = MyData { ... } makeLenses ''MyDataLenses -- makeLenses defines a namelist called MyDataLenses namelist ArithmeticOps (add) add = ... namelist ArithmeticOps (sub) sub = ... That being said, there are a lot of reasons why we wouldn't want to introduce such a mechanism, * we'd give up the comprehensive summary that the export list currently provides * haddock headings already provides a perfectly fine means for grouping logically related exports * it's hard to envision the implementation of such a feature without the introduction of new syntax * there are arguably few uses for such a mechanism beyond exporting TH constructs * you still have the work of solving the issues presented in #1475 Anyways, just a thought. Cheers, - Ben [1] http://ghc.haskell.org/trac/ghc/ticket/1475
pgpoddlH92BBj.pgp
Description: PGP signature
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe