Vigenere cipher in Haskell
It's a nice solution, but very long for a relatively simple task.

First, note that the cipher is called "Vigenère", so vignere would be considered a misspelling.

The type definitions…


type Secret = String
type PlainText = String
type CipherText = String



… provide an illusion of type safety, where there actually isn't any.  They are all just Strings.

All of the helper functions (encode, decode, shift, rightShift, leftShift, and encodeString) could just be reduced to a single function:

import Data.Char (chr, ord)

shift :: (Int -&gt; Int -&gt; Int) -&gt; Char -&gt; Char -&gt; Char
shift op offset ch = numToChar $ (charToNum ch) `op` (charToNum offset)
  where
    charToNum ch = ord ch - ord 'A'
    numToChar n = chr $ (n `mod` 26) + ord 'A'


Hiding the charToNum and numToChar helpers makes it easier to see what calls what.

With the generalized shift function defined, the enciphering and deciphering routines could each be one-liners:

vigenere :: String -&gt; String -&gt; String
vigenere secret = zipWith (shift (+)) (cycle secret) . concat . words

unvigenere :: String -&gt; String -&gt; String
unvigenere secret = zipWith (shift (-)) (cycle secret) . concat . words


Here, I've written them using point-free style to emphasize the fact that vigenere secret acts as an enciphering filter on the text.