neighbour-hoods / social_sensemaker

integration of `rep_lang` and Holochain
Other
25 stars 2 forks source link

add InterchangeEntry pretty printer #22

Closed mhuesch closed 2 years ago

mhuesch commented 2 years ago

this doesn't need to be a PR but I'm creating one because I want to document how the pretty printer looks when running in rlp:

 press q to exit, Tab to switch to creator.
 ┌viewer────────────────────────────────────────────────────────────────────────────────────────┐
 │InterchangeEntry {                                                                            │
 │  operator: 1,                                                                                │
 │  operands: [ ],                                                                              │
 │  output_scheme: Int,                                                                         │
 │  output_flat_value: 1,                                                                       │
 │  start_gas: 0,                                                                               │
 │}                                                                                             │
 │                                                                                              │
 │InterchangeEntry {                                                                            │
 │  operator: +,                                                                                │
 │  operands: [                                                                                 │
 │    InterchangeOperand(uhCkkboI9VZ_V1s5pM0j97vF66wcThve2QRs_n9VlxsUk9o_SgYkg),                │
 │    InterchangeOperand(uhCkkboI9VZ_V1s5pM0j97vF66wcThve2QRs_n9VlxsUk9o_SgYkg),                │
 │   ],                                                                                         │
 │  output_scheme: Int,                                                                         │
 │  output_flat_value: 2,                                                                       │
 │  start_gas: 2,                                                                               │
 │}                                                                                             │
 │                                                                                              │
 │InterchangeEntry {                                                                            │
 │  operator: +,                                                                                │
 │  operands: [ ],                                                                              │
 │  output_scheme: (Int -> (Int -> Int)),                                                       │
 │  output_flat_value: <<closure>>,                                                             │
 │  start_gas: 2,                                                                               │
 │}                                                                                             │
 │                                                                                              │
 │InterchangeEntry {                                                                            │
 │  operator: +,                                                                                │
 │  operands: [ InterchangeOperand(uhCkkboI9VZ_V1s5pM0j97vF66wcThve2QRs_n9VlxsUk9o_SgYkg), ],   │
 │  output_scheme: (Int -> Int),                                                                │
 │  output_flat_value: <<closure>>,                                                             │
 │  start_gas: 2,                                                                               │
 │}                                                                                             │
 │                                                                                              │
 └──────────────────────────────────────────────────────────────────────────────────────────────┘

I find the pretty crate to have some weird edge cases, but overall it seems to perform its job of laying things out depending on their width (relative to total frame width) ok.