import Data.List data Core tag a = Core a deriving Show data Ready data Rotated data Sorted input :: [a] -> Core Ready [a] input str = Core str rotate :: [a] -> [a] rotate [] = [] rotate (x:xs) = xs ++ [x] rotateAll :: [a] -> [[a]] rotateAll xs = take (length xs) (iterate rotate xs) circularShift :: Core Ready [[a]] -> Core Rotated [[[a]]] circularShift (Core str) = Core (map rotateAll str) alphabetize :: (Ord a) => Core Rotated [[a]] -> Core Sorted [[a]] alphabetize (Core str) = Core (map sort str) test :: [[String]] test = [["the quick", "brown fox"], ["jumps over", "the lazy dog"]]