-- https://cryptii.com/pipes/caesar-cipher
import Data.Char
cipher :: [Char] -> Int -> [Char]
cipher [] _ = []
cipher (x:xs) n = (if x `elem` chars
then (chars !! (rem (n + (ind x)) nchars))
else x) : (cipher xs n)
where
ind x = (ord x) - 97
chars = ['a'..'z']
nchars = length chars
-- Prelude> cipher "hello" 13
-- "uryyb"
main = putStrLn $ cipher "hello" 13