-
-
Save puffnfresh/5163683 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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