idris-lang / Idris2

A purely functional programming language with first class types
https://idris-lang.org/
Other
2.53k stars 380 forks source link

List packages improvements #3318

Closed mattpolzin closed 5 months ago

mattpolzin commented 5 months ago

Description

This makes some improvements to the output of the --list-packages Idris2 option. Mostly, my aim was to make it more apparent when different "advanced" installs of Idris and libraries has created a problem because libraries aren't installed with the same TTC version as Idris2. The improvements also make it clear when you have multiple installs of a library in your package path and where these libraries are -- useful because Idris only "sees" the first one it encounters.

Before, an example of output for a complex install might be:

base (Just 0.7.0)
base (Just 0.7.0)
contrib (Just 0.7.0)
contrib (Just 0.7.0)
linear (Just 0.7.0)
linear (Just 0.7.0)
network (Just 0.7.0)
network (Just 0.7.0)
prelude (Just 0.7.0)
prelude (Just 0.7.0)
test (Just 0.7.0)
test (Just 0.7.0)

After (I've mucked with the TTC folders to illustrate the output's utility):

Idris2 TTC Version: 2024060800
─────
base (0.7.0)
  ├ TTC Versions: 1034060801, 2024060800
  └ /Users/matt/.idris2/idris2-0.7.0
base (0.7.0)
  ├ TTC Versions: 2024060800
  └ /nix/store/lwhmll13r9dhz1s7nawdka9d9wj5xhwj-idris2-0.7.0/idris2-0.7.0
contrib (0.7.0)
  ├ TTC Versions: 1034060801
  └ /Users/matt/.idris2/idris2-0.7.0
contrib (0.7.0)
  ├ TTC Versions: 2024060800
  └ /nix/store/lwhmll13r9dhz1s7nawdka9d9wj5xhwj-idris2-0.7.0/idris2-0.7.0
linear (0.7.0)
  ├ TTC Versions: 2024060800
  └ /Users/matt/.idris2/idris2-0.7.0
linear (0.7.0)
  ├ TTC Versions: 2024060800
  └ /nix/store/lwhmll13r9dhz1s7nawdka9d9wj5xhwj-idris2-0.7.0/idris2-0.7.0
network (0.7.0)
  ├ TTC Versions: 2024060800
  └ /Users/matt/.idris2/idris2-0.7.0
network (0.7.0)
  ├ TTC Versions: 2024060800
  └ /nix/store/lwhmll13r9dhz1s7nawdka9d9wj5xhwj-idris2-0.7.0/idris2-0.7.0
prelude (0.7.0)
  ├ TTC Versions: 2024060800
  └ /Users/matt/.idris2/idris2-0.7.0
prelude (0.7.0)
  ├ TTC Versions: 2024060800
  └ /nix/store/lwhmll13r9dhz1s7nawdka9d9wj5xhwj-idris2-0.7.0/idris2-0.7.0
test (0.7.0)
  ├ TTC Versions: 2024060800
  └ /Users/matt/.idris2/idris2-0.7.0
test (0.7.0)
  ├ TTC Versions: 2024060800
  └ /nix/store/lwhmll13r9dhz1s7nawdka9d9wj5xhwj-idris2-0.7.0/idris2-0.7.0

What doesn't show up above is that mismatched versions of TTC show up in yellow given a terminal that supports colors.

Should this change go in the CHANGELOG?

gallais commented 5 months ago

Beautiful!