Convenience functions for working with Pgn
{ event : Maybe String
, site : Maybe String
, date : Maybe String
, round : Maybe String
, white : Maybe String
, black : Maybe String
, result : Maybe String
}
The SevenTag
data structure represents the standard values you'd expect to see in a PGN's tag pairs. The idea behind it is that if you want easy access to a result or the date a game took place, you shouldn't need to traverse a list!
toSevenTag : List Pgn.TagPair -> SevenTag
The toSevenTag
function takes a list of TagPair and does the work for you to produce common / expected values from a PGN tag pair.
pgn =
Pgn.parse "..."
sevenTag =
toSevenTag pgn.tagPairs
toString : Pgn -> String
The toString
can be helpful if you want to display a parsed PGN in a way that's visually parseable. It separates each TagPair with \n
, the TagPairs from the Moves with \n\n
, and each Move with \n