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 (Maybe Text)
- attributes :: Lens' Person (HashMap Text Text)
- birthdate :: Lens' Person (Maybe PartialDate)
- birthplace :: Lens' Person (Maybe Location)
- deathdate :: Lens' Person (Maybe PartialDate)
- deathplace :: Lens' Person (Maybe Location)
- attendedEvents :: Lens' Person IntSet
- data Family = Family {}
- head1 :: Lens' Family (Maybe PersonID)
- head2 :: Lens' Family (Maybe PersonID)
- children :: Lens' Family IntSet
- relationFrom :: Lens' Family (Maybe PartialDate)
- relationTo :: Lens' Family (Maybe PartialDate)
- relationship :: Lens' Family (Maybe Relationship)
- data Event = Event {}
- eventInfo :: Lens' Event Text
- eventDate :: Lens' Event (Maybe PartialDate)
- eventAttendees :: Lens' Event IntSet
- data FamilyTree = FamilyTree {}
- treeName :: Lens' FamilyTree Text
- people :: Lens' FamilyTree (IntMap Person)
- families :: Lens' FamilyTree (IntMap Family)
- events :: Lens' FamilyTree (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 -> IndexedTraversal' PersonID FamilyTree Person
- traverseFamily :: FamilyID -> IndexedTraversal' FamilyID FamilyTree Family
- traverseEvent :: EventID -> IndexedTraversal' 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 -> IndexedTraversal' PersonID FamilyTree PersonSource
Constructs a Traversal
for the manipulation of a person in a family tree, from
that person's ID.
traverseFamily :: FamilyID -> IndexedTraversal' FamilyID FamilyTree FamilySource
Constructs a lens for the manipulation of a family in a family tree, from that family's ID.
traverseEvent :: EventID -> IndexedTraversal' 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