Sfoglia il codice sorgente

Implement converter from Nat to int

DricomDragon 5 anni fa
parent
commit
6e767afd5a
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  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