Skip to content

Instantly share code, notes, and snippets.

@kowey
Created March 18, 2011 15:13
Show Gist options
  • Select an option

  • Save kowey/876235 to your computer and use it in GitHub Desktop.

Select an option

Save kowey/876235 to your computer and use it in GitHub Desktop.
module Choice where
data Choice a = Wanted a | Unwanted a
wanted :: Choice a -> Maybe a
wanted (Wanted s) = Just s
wanted (Unwanted _) = Nothing
-- | The item, regardless of whether it's wanted or not
undiscriminate :: Choice a -> a
undiscriminate (Wanted x) = x
undiscriminate (Unwanted x) = x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment