Created
April 22, 2025 20:20
-
-
Save jfdm/a4a3ac54ed837628670ef0c8a1e0cd8d to your computer and use it in GitHub Desktop.
Who needs first class modules when you can set records...
This file contains hidden or 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
record Bumpable type where | |
constructor B | |
bump : type -> type | |
myIntBumper : Bumpable Int | |
myIntBumper | |
= B (+ 1) | |
myNatBumper : Bumpable Nat | |
myNatBumper | |
= B (+ 1) | |
doubleBump : Bumpable a | |
-> a | |
-> a | |
doubleBump (B bump) y | |
= bump (bump y) | |
test : Equal | |
(doubleBump Adam.myNatBumper (the Nat 1)) | |
(the Nat 3) | |
test = Refl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment