module Data.Caesar where
type Caesar = Char
next :: Char -> Char
next c =
case c of
'.' -> '.'
' ' -> ' '
'ö' -> 'ä'
'ä' -> 'å'
'å' -> 'z'
'a' -> 'ö'
x -> pred x
caesar :: Int -> Caesar -> Caesar
caesar n x = foldr ($) x (replicate n next)