Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Commit

Permalink
added if0Nat to the SAWCore Prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddy Westbrook committed May 24, 2018
1 parent 46dfa1d commit cfdf475
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions prelude/Prelude.sawcore
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,11 @@ natCase :: (p :: Nat -> sort 0) -> p Zero -> ((n :: Nat) -> p (Succ n)) ->
(n :: Nat) -> p n;
natCase p z s = Nat__rec p z (\ (n::Nat) -> \ (r::p n) -> s n);

-- An if-then-else for whether a Nat = 0
if0Nat :: (a :: sort 0) -> Nat -> a -> a -> a;
if0Nat a n x y = natCase (\ (_::Nat) -> a) x (\ (_::Nat) -> y) n;


--------------------------------------------------------------------------------
-- "Vec n a" is an array of n elements, each with type "a".
primitive Vec :: Nat -> sort 0 -> sort 0;
Expand Down

0 comments on commit cfdf475

Please sign in to comment.