Skip to content

Commit

Permalink
[ log ] Print only a name of a constructor during logging
Browse files Browse the repository at this point in the history
  • Loading branch information
buzden committed Sep 12, 2023
1 parent c71881e commit 8ac3188
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Deriving/DepTyCheck/Util/Collections.idr
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import public Data.SortedSet
import public Data.Vect
import public Data.Vect.Dependent

import public Deriving.DepTyCheck.Util.Alternative
import public Deriving.DepTyCheck.Util.Fin
import public Deriving.DepTyCheck.Util.Syntax

Expand Down Expand Up @@ -72,6 +73,11 @@ inits' : (xs : List a) -> DVect xs.length $ \idx => Vect (S $ finToNat idx) a
inits' [] = []
inits' (x::xs) = [x] :: ((x ::) <$> inits' xs)

export
findLastIndex : (a -> Bool) -> (xs : List a) -> Maybe $ Fin xs.length
findLastIndex f [] = Nothing
findLastIndex f (x::xs) = FS <$> findLastIndex f xs <|> whenT (f x) FZ

--- Transitive clojure stuff ---

export covering
Expand Down
5 changes: 4 additions & 1 deletion src/Deriving/DepTyCheck/Util/Reflection.idr
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ Interpolation TTImp where

export
SingleLogPosition Con where
logPosition con = "\{show con.name}"
logPosition con = do
let fullName = show con.name
let fullName' = unpack fullName
maybe fullName (pack . flip drop fullName' . finToNat) $ findLastIndex (== '.') fullName'

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

0 comments on commit 8ac3188

Please sign in to comment.