Skip to content

Instantly share code, notes, and snippets.

@puffnfresh
Forked from fogus/gist:5163546
Created March 14, 2013 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puffnfresh/5163683 to your computer and use it in GitHub Desktop.
Save puffnfresh/5163683 to your computer and use it in GitHub Desktop.
data GenericThing = SpecificThing Char | BadThing
isSpecificThing :: GenericThing -> Bool
isSpecificThing (SpecificThing _) = True
isSpecificThing _ = False
foo :: [GenericThing] -> GenericThing
foo xs
| null xs = error "Empty GenericThings"
| all isSpecificThing xs = head xs
| otherwise = last xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment