mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-11-24 04:43:25 +03:00
827c51e343
Some way through the interfaces docs, but "using" for named parent interfaces is not implemented yet.
14 lines
281 B
Idris
14 lines
281 B
Idris
|
|
isSingleton : Bool -> Type
|
|
isSingleton True = Nat
|
|
isSingleton False = List Nat
|
|
|
|
mkSingle : (x : Bool) -> isSingleton x
|
|
mkSingle True = 0
|
|
mkSingle False = []
|
|
|
|
sum : (single : Bool) -> isSingleton single -> Nat
|
|
sum True x = x
|
|
sum False [] = 0
|
|
sum False (x :: xs) = x + sum False xs
|