amnh / PCG

𝙋𝙝𝙮𝙡𝙤𝙜𝙚𝙣𝙚𝙩𝙞𝙘 𝘾𝙤𝙢𝙥𝙤𝙣𝙚𝙣𝙩 𝙂𝙧𝙖𝙥𝙝 ⸺ Haskell program and libraries for general phylogenetic graph search
28 stars 1 forks source link

Replace Show instance of many data structures with render funtions that produce Text #92

Closed recursion-ninja closed 5 years ago

recursion-ninja commented 5 years ago

Many of the core data structures in Bio.Character, Bio.Graph, and Bio.Metadata all have multi-line Show instances designed to be used for output rendering. The Show type-class isn't intended (idiomatically) to be used for pretty printing or serialization. These Show instances should be replaced with explicit rendering functions of type a -> Text which are exported from their respective modules and the show call sites should be updated to use the Text rendering functions.

This will improve pretty printing to files as Text is more efficient. The rending functions can still be used in trace statements instead of show. This is related to #91.

Boarders commented 5 years ago

This is now done with the merge of the text-rendering branch. The report command now uses a custom function for writing text to a file which should use constant memory.