rseTicket :: Text -> Either Text (Maybe Internal.TicketName)
parseTicket t = case res of
    []  -> Right Nothing
    [x] -> Right $ Just x
    xs  -> Left $ "expected 1 ticket, but got " <> T.pack (show $ length xs)
  where res = filter (\(Internal.TicketName ticket) -> not $ T.null ticket) $
              map (Internal.TicketName . T.strip) $
              mapMaybe (T.stripPrefix "ticket:") $ T.lines t


parseTicket :: Text -> Either Text (Maybe Internal.TicketName)
parseTicket t = case res of
    []  -> Right Nothing
    [x] -> Right $ Just x
    xs  -> Left $ "expected 1 ticket, but got " <> T.pack (show $ length xs)
  where res = filter (\(Internal.TicketName ticket) -> not $ T.null ticket) $
              map (Internal.TicketName . T.strip) $
              mapMaybe (T.stripPrefix "ticket:") $ T.lines t
parseTicket t = case res of
    []  -> Right Nothing
    [x] -> Right $ Just x
    xs  -> Left $ "expected 1 ticket, but got " <> T.pack (show $ length xs)
  where res = filter (\(Internal.TicketName ticket) -> not $ T.null ticket) $
              map (Internal.TicketName . T.strip) $
              mapMaybe (T.stripPrefix "ticket:") $ T.lines t