Created
February 10, 2017 15:32
-
-
Save anton-trunov/90c77072bdb771076800b092998293bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%default total | |
data FS : (switch : Bool) -> Type where | |
FirstSimple : FS False | |
FirstSecond : FS True -> FS False | |
SecondSimple : FS True | |
SecondFirst : List (FS False) -> FS True | |
calculate : FS b -> Nat | |
calculate FirstSimple = 1 | |
calculate (FirstSecond x) = calculate x | |
calculate SecondSimple = 2 | |
calculate (SecondFirst xs) = foldl (\acc, x => acc + calculate x) 0 xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment