gedcom-0.2.0.0: Parser for the GEDCOM genealogy file format.

Copyright(c) Callum Lowcay 2017
LicenseBSD3
Maintainercwslowcay@gmail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Data.Gedcom.Internal.ParseMonads

Description

This module contains monads and utility functions for extracting GEDCOM records from the raw syntax tree.

Synopsis

Documentation

type StructureParser a Source #

Arguments

 = GDTree

The subtree to parse.

-> StructureMonad (Either GDTree a)

Either parsed structure, or the subtree itself if the subtree doesn't contain the expected GEDCOM structure.

A parser that extracts a GEDCOM structure from a GEDCOM subtree.

data MultiMonad a Source #

A Monad for parsing GEDCOM structures out of a list of GEDCOM subtrees.

runMultiMonad Source #

Arguments

:: [GDTree]

The subtrees to parse the structure from.

-> MultiMonad a

The MultiMonad that does the parsing.

-> StructureMonad a 

parseMulti :: StructureParser a -> MultiMonad [a] Source #

Parse multiple instances of a structure

parseOptional :: StructureParser a -> MultiMonad (Maybe a) Source #

Parse an optional instance of a structure

parseRequired Source #

Arguments

:: GDTag

The tag that identifies the required structure.

-> StructureParser a 
-> MultiMonad a 

Parse a required instance of a structure

addReference Source #

Arguments

:: Typeable a 
=> GDXRefID

The cross reference to add.

-> a

The value the reference will resolve to.

-> StructureMonad () 

Add a reference to the cross reference table.

runStructure :: StructureMonad a -> (Either GDError a, Map GDXRefID Dynamic) Source #

Run a StructureMonad, returning either an error or a value, and the cross reference table.