Skip to content

Instantly share code, notes, and snippets.

@jmitchell
Created July 17, 2014 17:51
Show Gist options
  • Save jmitchell/e1240e169cdb31fbb23e to your computer and use it in GitHub Desktop.
Save jmitchell/e1240e169cdb31fbb23e to your computer and use it in GitHub Desktop.
setInsert : Eq a => Vect n a -> a -> Either (Vect n a) (Vect (S n) a)
setInsert xs x = if elem x xs
then Left xs
else Right (x :: xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment