Portability | portable |
---|---|
Stability | unstable |
Maintainer | nvd124@gmail.com |
Safe Haskell | Safe-Infered |
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.
- data Person = Person {}
- data Family = Family {
- head1 :: Maybe Int
- head2 :: Maybe Int
- relationship :: Maybe Relationship
- relationFrom :: Maybe Day
- relationTo :: Maybe Day
- children :: IntSet
- data Event = Event {}
- data FamilyTree = FamilyTree {}
- data Location
- data Relationship
- newtype ID = ID Int
- newTree :: Text -> FamilyTree
- addPerson :: FamilyTree -> (FamilyTree, ID)
- addFamily :: FamilyTree -> (FamilyTree, ID)
- addEvent :: FamilyTree -> (FamilyTree, ID)
- personLens :: ID -> Lens FamilyTree Person
- familyLens :: ID -> Lens FamilyTree Family
- eventLens :: ID -> Lens FamilyTree Event
- deletePerson :: ID -> FamilyTree -> FamilyTree
- deleteFamily :: ID -> FamilyTree -> FamilyTree
- deleteEvent :: ID -> FamilyTree -> FamilyTree
Main types
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.
The basic type for a family. Which person is head1 and which is head2 is arbitrary, but try to use a consistent rule
Family | |
|
The basic type for an event. For example:
Event { eventInfo = "Battle of Agincourt" eventDate = fromGregorianValid 1415 10 25 eventAttendees = IM.empty }
Other types
The Location type. Either a coordinate or a placename.
data Relationship Source
The Relationship type. Marriage is the default for similarity to GEDCOM.
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.
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.