From 44aec1f56cc2f99791c2e15c67d00705e958cb1c Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Fri, 25 Nov 2016 17:37:02 +0100 Subject: [PATCH] add factorial --- src/Data/Nat.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Data/Nat.hs b/src/Data/Nat.hs index 1cf2634..58fd4a7 100644 --- a/src/Data/Nat.hs +++ b/src/Data/Nat.hs @@ -75,6 +75,10 @@ singletons [d| max Z n = n max n Z = n max (S n) (S m) = S (max n m) + + fact ∷ ℕ → ℕ + fact Z = S Z + fact (S n) = (S n) × (fact n) |]