mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-18 08:42:11 +03:00
14 lines
283 B
Idris
14 lines
283 B
Idris
|
interface Natty (n : Nat) where
|
||
|
|
||
|
fromNatty : Type -> Nat
|
||
|
fromNatty (Natty Z) = Z
|
||
|
fromNatty (Natty (S n)) = S (fromNatty (Natty n))
|
||
|
fromNatty _ = Z
|
||
|
|
||
|
main : IO ()
|
||
|
main = ignore $ traverse printLn
|
||
|
[ fromNatty (Natty 3)
|
||
|
, fromNatty (Natty (2 + 6))
|
||
|
, fromNatty (List (Natty 1))
|
||
|
]
|