Explorar el Código

Implement converter from Nat to int

DricomDragon hace 5 años
padre
commit
6e767afd5a
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  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