Skip to content

Commit

Permalink
[ derive ] Log used order using argument names too
Browse files Browse the repository at this point in the history
  • Loading branch information
buzden committed Aug 20, 2024
1 parent 1e54fb7 commit 8133e9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ namespace NonObligatoryExts

let theOrder = searchOrder $ removeDeeply givs determ

logPoint {level=10} "least-effort.order" [sig, con] "- used final order: \{show theOrder}"
logPoint {level=10} "least-effort.order" [sig, con] "- used final order: \{interpolate @{WithNames} theOrder}"

labelGen "\{show con.name} (orders)".label <$> genForOrder theOrder

Expand Down
10 changes: 10 additions & 0 deletions src/Deriving/DepTyCheck/Util/Reflection.idr
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ SingleLogPosition Con where
let fullName' = unpack fullName
maybe fullName (pack . flip drop fullName' . S . finToNat) $ findLastIndex (== '.') fullName'

export
[WithName] {con : Con} -> Interpolation (Fin con.args.length) where
interpolate i = case name $ index' con.args i of
Nothing => "#\{show i}"
Just n => "\{show n} (#\{show i})"

export
[WithNames] {con : Con} -> Foldable f => Interpolation (f $ Fin con.args.length) where
interpolate xs = joinBy ", " $ toList xs <&> interpolate @{WithName}

----------------------------------------------
--- Compiler-based `TTImp` transformations ---
----------------------------------------------
Expand Down

0 comments on commit 8133e9c

Please sign in to comment.