Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anton-trunov/90c77072bdb771076800b092998293bc to your computer and use it in GitHub Desktop.
Save anton-trunov/90c77072bdb771076800b092998293bc to your computer and use it in GitHub Desktop.
%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