Skip to content

Instantly share code, notes, and snippets.

@bvssvni
Created April 17, 2014 12:16
Show Gist options
  • Save bvssvni/10978809 to your computer and use it in GitHub Desktop.
Save bvssvni/10978809 to your computer and use it in GitHub Desktop.
-- describes an Integer representation of Bools
-- that also specify how many bits are used
data BitVector : Integer -> Integer -> Type
-- I want to make sure that the value of the integer
-- is always less than 2^first_argument.
-- Is this possible?
-- takes two Bool and return an Integer.
pairOfBoolsToInteger : Bool -> Bool -> BitVector 2 Integer
pairOfBoolsToInteger a b = case (a, b) of
(False, False) => 0
(True, False) => 1
(False, True) => 2
(True, True) => 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment