family-tree-0.1.2: Family trees with lenses

Portabilityportable
Stabilityunstable
Maintainernvd124@gmail.com
Safe HaskellSafe-Infered

Data.FamilyTree

Contents

Description

This module is for Family Trees.

It uses lenses for the manipulation of people. For the usage of lenses, see Data.Lens.Lazy

It is reccomended to use Data.Binary to do saving and loading.

Synopsis

Main types

data Person Source

The basic type for a person. Nothing meaning unknown (or otherwise non-existent, for intance a death date for someone still alive) is a convention used throughout this library.

data Family Source

The basic type for a family. Which person is head1 and which is head2 is arbitrary, but try to use a consistent rule

data Event Source

The basic type for an event. For example:

   Event {
     eventInfo = "Battle of Agincourt"
     eventDate = fromGregorianValid 1415 10 25
     eventAttendees = IM.empty
         }

Constructors

Event 

Instances

data FamilyTree Source

The core structure of a family tree.

Other types

data Location Source

The Location type. Either a coordinate or a placename.

data Relationship Source

The Relationship type. Marriage is the default for similarity to GEDCOM.

Constructors

Marriage 
Other Text 

newtype ID Source

ID represents an identifier for a person, family, or event. While the constructor is exported, it is probably better to use the various lenses for manipulation, as they echo the changes around the tree.

Constructors

ID Int 

Creation

newTree :: Text -> FamilyTreeSource

Creates a new tree with a given name.

addPerson :: FamilyTree -> (FamilyTree, ID)Source

Adds a person with minimal information, returning the updated family tree and the ID of the new person.

addFamily :: FamilyTree -> (FamilyTree, ID)Source

Adds a family with minimal information, returning the updated family tree and the ID of the new family.

addEvent :: FamilyTree -> (FamilyTree, ID)Source

Adds an event with minimal information, returning the updated family tree and the ID of the new event.

Manipulation

personLens :: ID -> Lens FamilyTree PersonSource

Constructs a lens for the manipulation of a person in a family tree, from that person's ID. Using an ID that does not correspond to a person is an error, and it is impossible to create or destroy people using a lens created by this.

familyLens :: ID -> Lens FamilyTree FamilySource

Constructs a lens for the manipulation of a family in a family tree, from that family's ID. Using an ID that does not correspond to a family is an error, and it is impossible to create or destroy families using a lens created by this.

eventLens :: ID -> Lens FamilyTree EventSource

Constructs a lens for the manipulation of an event in a family tree, from that event's ID. Using an ID that does not correspond to an event is an error, and it is impossible to create or destroy events using a lens created by this.

Destruction

deletePerson :: ID -> FamilyTree -> FamilyTreeSource

Deletes a person from the family tree, removing all references to them.

deleteFamily :: ID -> FamilyTree -> FamilyTreeSource

Deletes a family from the family tree, removing all references to it.

deleteEvent :: ID -> FamilyTree -> FamilyTreeSource

Deletes an event from the family tree, removing all references to it.