Created
October 30, 2014 00:15
-
-
Save jayunit100/ec3e997d9bf3e85efee9 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
~ |355 instance Read Color where | |
~ |356 readsPrec _ value = | |
~ |357 tryParse [("Red", Red), ("Green", Green), ("Blue", Blue)] | |
~ |358 where tryParse [] = [] | |
~ |359 tryParse ((attempt, result):xs) = | |
~ |360 if (take (length attempt) value ) == attempt | |
~ |361 then [(result, drop (length attempt))] | |
~ |362 else tryParse xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment