Here is code that will output maven coordinates from given pom.xml file. How can I remove boilerplate (possibly convert it to xml picklers)?import Control.Lens ((&))import Text.XML.HXT.Coreimport System.Environment (getArgs)import Text.XML.HXT.Arrow.XmlArrowimport Control.Monad (liftM)import Data.Maybeimport Control.Applicativemain = do  (filename:_) <- getArgs  _groupId <- extractOne filename $ project >>> groupId  _artifactId <- extractOne filename $ project >>> artifactId  _version <- extractOne filename $ project >>> version  _parentGroupId <- extractOne filename $ project >>> parent >>> groupId  _parentArtifactId <- extractOne filename $ project >>> parent >>> artifactId  _parentVersion <- extractOne filename $ project >>> parent >>> version  let coordinate = (,,) <$> _groupId <*> _artifactId <*> _version      parentCoordinate = (,,) <$> _parentGroupId <*> _parentArtifactId <*> _parentVersion      in do        print coordinate        print parentCoordinateextract :: String -> IOSArrow XmlTree a -> IO [a]extract filename cat = runX $ readDocument [withValidate no] filename >>> catextractOne :: String -> IOSArrow XmlTree a -> IO (Maybe a)extractOne filename cat = extract filename cat >>= return . listToMaybeversion :: ArrowXml a => a XmlTree Stringversion = getChildren >>> hasName version >>> getChildren >>> getTextartifactId :: ArrowXml a => a XmlTree StringartifactId = getChildren >>> hasName artifactId >>> getChildren >>> getTextgroupId :: ArrowXml a => a XmlTree StringgroupId = getChildren >>> hasName groupId >>> getChildren >>> getTextparent :: ArrowXml a => a XmlTree XmlTreeparent = getChildren >>> hasName parentproject :: ArrowXml a => a XmlTree XmlTreeproject = getChildren >>> hasName project
Simplify XML parsing using HXT
haskell;xml