| Copyright | (c) 2021 Alexander E. Zarebski |
|---|---|
| License | MIT |
| Maintainer | Alexander E. Zarebski <aezarebski@gmail.com> |
| Stability | unstable |
| Portability | ghc |
| Safe Haskell | None |
| Language | Haskell2010 |
Epidemic.Types.Population
Description
This module defines some types and functions for working with identifiers, persons, people, and populations.
- An
Identifieris used as a unique label for aPerson, - a
Personis a single individual, - a group of
Peopleis a collection of persons, - and
Populationis 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
Constructors
| Person Identifier |
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.
Methods
susceptiblePeople :: a -> Maybe People Source #
infectiousPeople :: a -> Maybe People Source #
removedPeople :: a -> Maybe People Source #
isInfected :: a -> Bool Source #
Instances
| Population LogisticBDSDPopulation Source # | |
Defined in Epidemic.Model.LogisticBDSD | |
| Population InhomBDSCODPop Source # | |
Defined in Epidemic.Model.InhomogeneousBDSCOD Methods susceptiblePeople :: InhomBDSCODPop -> Maybe People Source # infectiousPeople :: InhomBDSCODPop -> Maybe People Source # removedPeople :: InhomBDSCODPop -> Maybe People Source # isInfected :: InhomBDSCODPop -> Bool Source # | |
| Population InhomBDSPop Source # | |
Defined in Epidemic.Model.InhomogeneousBDS Methods susceptiblePeople :: InhomBDSPop -> Maybe People Source # infectiousPeople :: InhomBDSPop -> Maybe People Source # removedPeople :: InhomBDSPop -> Maybe People Source # isInfected :: InhomBDSPop -> Bool Source # | |
| Population BDSCODPopulation Source # | |
Defined in Epidemic.Model.BDSCOD Methods susceptiblePeople :: BDSCODPopulation -> Maybe People Source # infectiousPeople :: BDSCODPopulation -> Maybe People Source # removedPeople :: BDSCODPopulation -> Maybe People Source # isInfected :: BDSCODPopulation -> Bool Source # | |
newtype Identifier Source #
A type to hold an integer which is unique to each Person.
Constructors
| Identifier Integer |
Instances
| Eq Identifier Source # | |
Defined in Epidemic.Types.Population | |
| Show Identifier Source # | |
Defined in Epidemic.Types.Population Methods showsPrec :: Int -> Identifier -> ShowS # show :: Identifier -> String # showList :: [Identifier] -> ShowS # | |
| Generic Identifier Source # | |
Defined in Epidemic.Types.Population Associated Types type Rep Identifier :: Type -> Type # | |
| ToJSON Identifier Source # | |
Defined in Epidemic.Types.Population Methods toJSON :: Identifier -> Value # toEncoding :: Identifier -> Encoding # toJSONList :: [Identifier] -> Value # toEncodingList :: [Identifier] -> Encoding # | |
| FromJSON Identifier Source # | |
Defined in Epidemic.Types.Population | |
| type Rep Identifier Source # | |
Defined in Epidemic.Types.Population type Rep Identifier = D1 ('MetaData "Identifier" "Epidemic.Types.Population" "epi-sim-0.7.0-DViI2uXntfg6JZVuToo6fh" 'True) (C1 ('MetaCons "Identifier" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer))) | |
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