浏览代码

Implement converter from Nat to int

DricomDragon 5 年之前
父节点
当前提交
6e767afd5a
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      peano.hs

+ 3 - 0
peano.hs

@@ -1,2 +1,5 @@
 data Nat = Zero | Succ Nat
 
+intValOf thisNat = case thisNat of
+	Zero -> 0
+	Succ nextNat -> 1 + intValOf nextNat