module DNA (toRNA) where

toRNA :: String -> Either Char String
toRNA = mapM fromDNA
  where
    fromDNA :: Char -> Either Char Char
    fromDNA 'C' = return 'G'
    fromDNA 'G' = return 'C'
    fromDNA 'A' = return 'U'
    fromDNA 'T' = return 'A'
    fromDNA  c  = Left c

module DNA (toRNA) where

toRNA :: String -> Either Char String
toRNA = traverse fromDNA
  where
    fromDNA :: Char -> Either Char Char
    fromDNA 'C' = return 'G'
    fromDNA 'G' = return 'C'
    fromDNA 'A' = return 'U'
    fromDNA 'T' = return 'A'
    fromDNA  c  = Left c

Change `mapM` to `traverse` in example
rna-transcription: Change `mapM` to `traverse` in example

`mapM` is just an alias for `traverse`, and `traverse` is the more
general and preferred version.
