Skip to content

Instantly share code, notes, and snippets.

@corajr
Created November 27, 2015 18:47
Show Gist options
  • Select an option

  • Save corajr/6e5f13b9aab1e1d2958f to your computer and use it in GitHub Desktop.

Select an option

Save corajr/6e5f13b9aab1e1d2958f to your computer and use it in GitHub Desktop.
module Example where
{-@ divide' :: Int -> {v: Int | v != 0} -> Int @-}
divide' :: Int -> Int -> Int
divide' n d = n `div` d
-- liquid knows we're lying!
{-@ maybeZero :: Bool -> {v: Int | v != 0} @-}
maybeZero :: Bool -> Int
maybeZero True = 1
maybeZero False = 0
divResult = divide' 4 (maybeZero False)
-- div1 = divide' 4 1
main = print divResult
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment