Idris2-boot/samples/fctypes.idr
Edwin Brady 827c51e343 More documentation updates
Some way through the interfaces docs, but "using" for named parent
interfaces is not implemented yet.
2020-02-25 21:01:15 +00:00

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