Copyright | (c) 2021 Alexander E. Zarebski |
---|---|
License | MIT |
Maintainer | Alexander E. Zarebski <aezarebski@gmail.com> |
Stability | unstable |
Portability | ghc |
Safe Haskell | None |
Language | Haskell2010 |
This module defines some types and functions for working with identifiers, persons, people, and populations.
- An
Identifier
is used as a unique label for aPerson
, - a
Person
is a single individual, - a group of
People
is a collection of persons, - and
Population
is a typeclass for working with people that have some structure.
Synopsis
- newtype Person = Person Identifier
- newtype People = People (Vector Person)
- class Population a where
- susceptiblePeople :: a -> Maybe People
- infectiousPeople :: a -> Maybe People
- removedPeople :: a -> Maybe People
- isInfected :: a -> Bool
- newtype Identifier = Identifier Integer
- asPeople :: [Person] -> People
- includesPerson :: People -> Person -> Bool
- haveCommonPeople :: People -> People -> Bool
- nullPeople :: People -> Bool
- numPeople :: People -> Int
- addPerson :: Person -> People -> People
- removePerson :: Person -> People -> People
- personByteString :: Person -> Builder
Documentation
A type to represent a single person in a group of People
Instances
Eq Person Source # | |
Show Person Source # | |
Generic Person Source # | |
ToJSON Person Source # | |
Defined in Epidemic.Types.Population | |
FromJSON Person Source # | |
type Rep Person Source # | |
Defined in Epidemic.Types.Population type Rep Person = D1 ('MetaData "Person" "Epidemic.Types.Population" "epi-sim-0.7.0-DViI2uXntfg6JZVuToo6fh" 'True) (C1 ('MetaCons "Person" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Identifier))) |
A type to represent a population.
class Population a where Source #
Class of types that can represent populations in an epidemic simulation.
susceptiblePeople :: a -> Maybe People Source #
infectiousPeople :: a -> Maybe People Source #
removedPeople :: a -> Maybe People Source #
isInfected :: a -> Bool Source #
Instances
newtype Identifier Source #
A type to hold an integer which is unique to each Person
.
Instances
includesPerson :: People -> Person -> Bool Source #
Predicate for whether a person is one of the people
haveCommonPeople :: People -> People -> Bool Source #
Predicate for whether two sets of people have any members in common.
nullPeople :: People -> Bool Source #
Predicate for whether there are any people
personByteString :: Person -> Builder Source #
A bytestring builder for a person