Created
January 28, 2018 19:32
-
-
Save ploeh/4bfa18c0a23387f2396f1d1aac06cc0f to your computer and use it in GitHub Desktop.
Quick bit of fun inspired by https://twitter.com/mtnygard/status/957668346933207044
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
module RadioCode where | |
import Control.Arrow | |
import Data.Char | |
import Data.List | |
import Data.Maybe | |
icao :: [(Char, String)] | |
icao = | |
(head &&& delete ',') | |
<$> words "Alfa, Bravo, Charlie, Delta, Echo, Foxtrot, Golf, Hotel, India, Juliett, Kilo, Lima, Mike, November, Oscar, Papa, Quebec, Romeo, Sierra, Tango, Uniform, Victor, Whiskey, X-ray, Yankee, Zulu" | |
radioCode :: String -> String | |
radioCode = unwords . catMaybes . fmap ((`lookup` icao) . toUpper) | |
message :: String | |
message = radioCode "If you can read this" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment