Skip to content

Instantly share code, notes, and snippets.

@ploeh

ploeh/RadioCode.hs

Created Jan 28, 2018
Embed
What would you like to do?
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
You can’t perform that action at this time.