parser =
  SwapPos <$> ("swap position " *> decimal)
          <*> (" with position " *> decimal) <|>
  SwapLetter <$> ("swap letter " *> letter)
             <*> (" with letter " *> letter) <|>
  Rotate <$> ("rotate " *> lr) <* (" step" *> many "s") <|>
  Reverse <$> ("reverse positions " *> decimal)
          <*> (" through " *> decimal) <|>
  RotateLetter <$> ("rotate based on position of letter " *> letter) <|>
  Move <$> ("move position " *> decimal)
       <*> (" to position " *> decimal)
  where lr = "left " *> decimal <|>
             "right " *> (neg <$> decimal)
        neg x = - x
parser =
  SwapPos <$> ("swap position " *> decimal)
          <*> (" with position " *> decimal) <|>
  SwapLetter <$> ("swap letter " *> letter)
             <*> (" with letter " *> letter) <|>
  Rotate <$> ("rotate " *> lr) <* (" step" *> many "s") <|>
  Reverse <$> ("reverse positions " *> decimal)
          <*> (" through " *> decimal) <|>
  RotateLetter <$> ("rotate based on position of letter " *> letter) <|>
  Move <$> ("move position " *> decimal)
       <*> (" to position " *> decimal)
  where lr = "left " *> decimal <|>
             "right " *> (neg <$> decimal)
        neg x = - x
parser =
  SwapPos <$> ("swap position " *> decimal)
          <*> (" with position " *> decimal) <|>
  SwapLetter <$> ("swap letter " *> letter)
             <*> (" with letter " *> letter) <|>
  Rotate <$> ("rotate " *> lr) <* (" step" *> many "s") <|>
  Reverse <$> ("reverse positions " *> decimal)
          <*> (" through " *> decimal) <|>
  RotateLetter <$> ("rotate based on position of letter " *> letter) <|>
  Move <$> ("move position " *> decimal)
       <*> (" to position " *> decimal)
  where lr = "left " *> decimal <|>
             "right " *> (neg <$> decimal)
        neg x = - x