-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use reflection to populate property proofs that were annoying to update.
- Loading branch information
1 parent
3c4a569
commit f7e70fc
Showing
2 changed files
with
50 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Util.Reflection | ||
|
||
import Language.Reflection | ||
|
||
public export | ||
record Clause where | ||
constructor MkClause | ||
lhs : Name | ||
rhs : TTImp | ||
|
||
||| Useful for elaborating basic properties where you want to know that | ||
||| a function is either covering or onto w/r/t a datatype. | ||
||| See e.g. `Data.Config.SettablePropNamedProperties` | ||
||| | ||
||| case `ofParam` of | ||
||| `clauseFn <$> cases` | ||
public export | ||
elabCase : (ofParam : TTImp) -> (ty : TTImp) -> (cases : List Name) -> (clauseFn : Name -> Util.Reflection.Clause) -> TTImp | ||
elabCase ofParam ty cases clauseFn = | ||
ICase EmptyFC [] ofParam ty $ (\c => PatClause EmptyFC (IVar EmptyFC c.lhs) c.rhs) . clauseFn <$> cases | ||
|