Created
August 16, 2020 16:56
-
-
Save bigs/316bf0295514ef35e3237774e1546092 to your computer and use it in GitHub Desktop.
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
module Adder | |
AdderType : Nat -> Type | |
AdderType 0 = Int | |
AdderType (S k) = Int -> AdderType k | |
adder : {n : Nat} -> {default 0 acc : Int} -> AdderType n | |
adder {n=Z} {acc} = acc | |
adder {n=S k} {acc} = \x => adder {n=k} {acc=acc + x} | |
-- adder {n=3} 3 5 7 | |
-- 15 |
Author
bigs
commented
Aug 16, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment