Skip to content

Instantly share code, notes, and snippets.

@crclark96
Created May 6, 2020 12:48
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 crclark96/adeb18b9279f16195dc97e7d03d2dc06 to your computer and use it in GitHub Desktop.
Save crclark96/adeb18b9279f16195dc97e7d03d2dc06 to your computer and use it in GitHub Desktop.
*Main> oneRow ["candy","doodle","pop","shield","lag","typewriter"]
["pop","lag","typewriter"]
import Data.List (intersect)
r0 = "`1234567890-=~!@#$%^&*()_+"
r1 = "qwertyuiop[]\\QWERTYUIOP{}|"
r2 = "asdfghjkl;'ASDFGHJKL:\""
r3 = "zxcvbnm,./ZXCVBNM<>?"
oneRow :: [String] -> [String]
oneRow = filter oneRow'
where oneRow' s = or $ map (subset s) [r0,r1,r2,r3]
subset xs ys = intersect xs ys == xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment