Portability | portable |
---|---|
Stability | unstable |
Maintainer | nvd124@gmail.com |
Safe Haskell | None |
This module is for Family Trees.
It uses lenses for the manipulation of people. For the usage of lenses, see Control.Lens
It is reccomended to use Data.Binary to do saving and loading.
- data Person = Person {}
- name :: Lens Person Person (Maybe Text) (Maybe Text)
- attributes :: Lens Person Person (HashMap Text Text) (HashMap Text Text)
- birthdate :: Lens Person Person (Maybe PartialDate) (Maybe PartialDate)
- birthplace :: Lens Person Person (Maybe Location) (Maybe Location)
- deathdate :: Lens Person Person (Maybe PartialDate) (Maybe PartialDate)
- deathplace :: Lens Person Person (Maybe Location) (Maybe Location)
- attendedEvents :: Lens Person Person IntSet IntSet
- data Family = Family {}
- head1 :: Lens Family Family (Maybe PersonID) (Maybe PersonID)
- head2 :: Lens Family Family (Maybe PersonID) (Maybe PersonID)
- children :: Lens Family Family IntSet IntSet
- relationFrom :: Lens Family Family (Maybe PartialDate) (Maybe PartialDate)
- relationTo :: Lens Family Family (Maybe PartialDate) (Maybe PartialDate)
- relationship :: Lens Family Family (Maybe Relationship) (Maybe Relationship)
- data Event = Event {}
- eventInfo :: Lens Event Event Text Text
- eventDate :: Lens Event Event (Maybe PartialDate) (Maybe PartialDate)
- eventAttendees :: Lens Event Event IntSet IntSet
- data FamilyTree = FamilyTree {}
- treeName :: Lens FamilyTree FamilyTree Text Text
- people :: Lens FamilyTree FamilyTree (IntMap Person) (IntMap Person)
- families :: Lens FamilyTree FamilyTree (IntMap Family) (IntMap Family)
- events :: Lens FamilyTree FamilyTree (IntMap Event) (IntMap Event)
- newtype PersonID = PersonID {
- getPersonID :: Int
- newtype FamilyID = FamilyID {
- getFamilyID :: Int
- newtype EventID = EventID {
- getEventID :: Int
- type PartialDate = Interval Day
- data Location
- data Relationship
- newTree :: Text -> FamilyTree
- addPerson :: FamilyTree -> (PersonID, FamilyTree)
- addFamily :: FamilyTree -> (FamilyID, FamilyTree)
- addEvent :: FamilyTree -> (EventID, FamilyTree)
- traversePerson :: PersonID -> SimpleIndexedTraversal PersonID FamilyTree Person
- traverseFamily :: FamilyID -> SimpleIndexedTraversal FamilyID FamilyTree Family
- traverseEvent :: EventID -> SimpleIndexedTraversal EventID FamilyTree Event
- deletePerson :: PersonID -> FamilyTree -> FamilyTree
- deleteFamily :: FamilyID -> FamilyTree -> FamilyTree
- deleteEvent :: EventID -> FamilyTree -> FamilyTree
- partialDateFromYear :: Integer -> PartialDate
- partialDateFromMonth :: Integer -> Int -> PartialDate
- partialDateFromDay :: Integer -> Int -> Int -> PartialDate
Types
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.
Person | |
|
The basic type for a family. Which person is head1 and which is head2 is arbitrary, but try to use a consistent rule
The basic type for an event. For example:
Event { _eventInfo = "Battle of Agincourt" _eventDate = fromGregorianValid 1415 10 25 _eventAttendees = IM.empty }
ID types
The various ID types represent an identifier for a person, family, or event.
While the constructors are exported, it is probably better to use the
various Traversal
s for manipulation, as they echo the changes around the
tree automatically.
EventID | |
|
Other types
type PartialDate = Interval DaySource
The Location type. Either a coordinate or a placename.
data Relationship Source
The Relationship type. Marriage is the default for similarity to GEDCOM.
Functions
Creation
newTree :: Text -> FamilyTreeSource
Creates a new tree with a given name.
addPerson :: FamilyTree -> (PersonID, FamilyTree)Source
Adds a person with minimal information, returning the updated family tree and the ID of the new person.
addFamily :: FamilyTree -> (FamilyID, FamilyTree)Source
Adds a family with minimal information, returning the updated family tree and the ID of the new family.
addEvent :: FamilyTree -> (EventID, FamilyTree)Source
Adds an event with minimal information, returning the updated family tree and the ID of the new event.
Manipulation
traversePerson :: PersonID -> SimpleIndexedTraversal PersonID FamilyTree PersonSource
Constructs a Traversal
for the manipulation of a person in a family tree, from
that person's ID.
traverseFamily :: FamilyID -> SimpleIndexedTraversal FamilyID FamilyTree FamilySource
Constructs a lens for the manipulation of a family in a family tree, from that family's ID.
traverseEvent :: EventID -> SimpleIndexedTraversal EventID FamilyTree EventSource
Constructs a Traversal
for the manipulation of an event in a family tree, from
that event's ID.
Destruction
deletePerson :: PersonID -> FamilyTree -> FamilyTreeSource
Deletes a person from the family tree, removing all references to them.
deleteFamily :: FamilyID -> FamilyTree -> FamilyTreeSource
Deletes a family from the family tree, removing all references to it.
deleteEvent :: EventID -> FamilyTree -> FamilyTreeSource
Deletes an event from the family tree, removing all references to it.
Utility functions
partialDateFromMonth :: Integer -> Int -> PartialDateSource
partialDateFromDay :: Integer -> Int -> Int -> PartialDateSource