Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ derive ] Support printing derived gens with Idris representation #190

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Deriving/DepTyCheck/Gen/Entry.idr
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,16 @@ deriveGenFor a = do

||| Declares `main : IO Unit` function that prints derived generator for the given generator's signature
export
deriveGenPrinter : DerivatorCore => Type -> Elab Unit
deriveGenPrinter : {default True printTTImp : Bool} -> DerivatorCore => Type -> Elab Unit
deriveGenPrinter ty = do
ty <- quote ty
logSugaredTerm "deptycheck.derive.print" DefaultLogLevel "type" ty
expr <- deriveGenExpr ty
expr <- quote expr
printTTImp <- quote printTTImp
declare `[
main : IO Unit
main = do
putStr $ interpolate ~(expr)
putStr $ if ~printTTImp then interpolate ~expr else show ~expr
putStrLn ""
]