Skip to content

Instantly share code, notes, and snippets.

@opqdonut
Created February 22, 2012 13:17
Show Gist options
  • Save opqdonut/1885148 to your computer and use it in GitHub Desktop.
Save opqdonut/1885148 to your computer and use it in GitHub Desktop.
{-# LANGUAGE ViewPatterns #-}
check p x = if p x
then x
else error "check failed!"
positive = (>0)
intDivide :: Int -> Int -> Int
intDivide x (check positive -> y) = x `div` y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment