ebird-api-0.2.0.0: A Haskell description of the eBird API
Copyright(c) 2023 Finley McIlwaine
LicenseMIT (see LICENSE)
MaintainerFinley McIlwaine <finleymcilwaine@gmail.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.EBird.API.Regions

Description

Types related to eBird region API values.

Synopsis

Region-related API types

data Region Source #

eBird divides the world into countries, subnational1 regions (states) or subnational2 regions (counties). Location regions are eBird-specific location identifiers.

Constructors

Location Integer

Regions may be specified as location IDs, e.g. L227544

World

The world is a region

Country Text

At the top level, the world is divided into countries

Subnational1

Subnational1 regions are states within countries

Fields

Subnational2

Subnational2 regions are counties within states

Fields

Instances

Instances details
IsString Region Source #

Use this instance carefully! It throws runtime exceptions if the string is malformatted.

Instance details

Defined in Data.EBird.API.Regions

Methods

fromString :: String -> Region #

Read Region Source # 
Instance details

Defined in Data.EBird.API.Regions

Show Region Source # 
Instance details

Defined in Data.EBird.API.Regions

EBirdString Region Source #

A Region eBird string is either:

  • "L227544" for location regions, where L227544 is the location ID.
  • "world" for World regions.
  • The country identifier (e.g. "US" for the United States) for Country regions.
  • The country identifier and the state identifier separated by a hyphen for Subnational1 regions (e.g. "US-WY" for Wyoming in the United States).
  • The county identifier, the state identifier, and the country identifier separated by hyphens for Subnational2 regions (e.g. US-WY-013)
Instance details

Defined in Data.EBird.API.Regions

Eq Region Source # 
Instance details

Defined in Data.EBird.API.Regions

Methods

(==) :: Region -> Region -> Bool #

(/=) :: Region -> Region -> Bool #

ToHttpApiData Region Source # 
Instance details

Defined in Data.EBird.API.Regions

FromJSON Region Source # 
Instance details

Defined in Data.EBird.API.Regions

ToJSON Region Source # 
Instance details

Defined in Data.EBird.API.Regions

k ~ A_Lens => LabelOptic "countryCode" k (ObservationDetails 'Full) (ObservationDetails 'Full) Region Region Source # 
Instance details

Defined in Data.EBird.API.Observations

k ~ A_Lens => LabelOptic "subnational1Code" k (ObservationDetails 'Full) (ObservationDetails 'Full) Region Region Source # 
Instance details

Defined in Data.EBird.API.Observations

k ~ A_Lens => LabelOptic "subnational2Code" k (ObservationDetails 'Full) (ObservationDetails 'Full) Region Region Source # 
Instance details

Defined in Data.EBird.API.Observations

data RegionType Source #

One constructor per eBird "region type" (countries, subnational1 (states), or subnational2 (counties)).

Instances

Instances details
IsString RegionType Source #

Use this instance carefully! It throws runtime exceptions if the string is malformatted.

Instance details

Defined in Data.EBird.API.Regions

Read RegionType Source # 
Instance details

Defined in Data.EBird.API.Regions

Show RegionType Source # 
Instance details

Defined in Data.EBird.API.Regions

EBirdString RegionType Source #

Results in eBird region type format

Instance details

Defined in Data.EBird.API.Regions

Eq RegionType Source # 
Instance details

Defined in Data.EBird.API.Regions

ToHttpApiData RegionType Source # 
Instance details

Defined in Data.EBird.API.Regions

newtype RegionCode Source #

A RegionCode is a list of one or more Regions.

Instances

Instances details
IsString RegionCode Source #

Use this instance carefully! It throws runtime exceptions if the string is malformatted.

Instance details

Defined in Data.EBird.API.Regions

Read RegionCode Source # 
Instance details

Defined in Data.EBird.API.Regions

Show RegionCode Source # 
Instance details

Defined in Data.EBird.API.Regions

EBirdString RegionCode Source #

A RegionCode eBird string is a comma-separated list of regions.

Instance details

Defined in Data.EBird.API.Regions

Eq RegionCode Source # 
Instance details

Defined in Data.EBird.API.Regions

ToHttpApiData RegionCode Source # 
Instance details

Defined in Data.EBird.API.Regions

FromJSON RegionCode Source # 
Instance details

Defined in Data.EBird.API.Regions

ToJSON RegionCode Source # 
Instance details

Defined in Data.EBird.API.Regions

data RegionNameFormat Source #

RegionNameFormat values specify what format the API should return region names in. See the constructor docs for examples.

Constructors

DetailedNameFormat

DetailedNameFormat region name values are fully qualified with only the country abbreviated, e.g. "Madison County, New York, US"

DetailedNoQualNameFormat

DetailedNoQualNameFormat region name values are like DetailedNameFormat but without the country qualifier and no "county" annotation, e.g. "Madison, New York"

FullNameFormat

FullNameFormat region name values are fully qualified with no abbreviated country name and no "county" annotation, e.g. "Madison, New York, United States"

NameQualNameFormat

NameQualNameFormat region name values are just the annotated name, e.g. "Madison County"

NameOnlyNameFormat

NameOnlyNameFormat region name values are just the name, e.g. "Madison"

RevDetailedNameFormat

RevDetailedNameFormat region name values are like DetailedNameFormat but with reverse qualifiers, e.g. "US, New York, Madison County"

Instances

Instances details
IsString RegionNameFormat Source #

Use this instance carefully! It throws runtime exceptions if the string is malformatted.

Instance details

Defined in Data.EBird.API.Regions

Read RegionNameFormat Source # 
Instance details

Defined in Data.EBird.API.Regions

Show RegionNameFormat Source # 
Instance details

Defined in Data.EBird.API.Regions

EBirdString RegionNameFormat Source #

A RegionNameFormat is shown as the constructor name without the NameFormat suffix, in all lower-case.

Instance details

Defined in Data.EBird.API.Regions

Eq RegionNameFormat Source # 
Instance details

Defined in Data.EBird.API.Regions

ToHttpApiData RegionNameFormat Source # 
Instance details

Defined in Data.EBird.API.Regions

data RegionInfo Source #

RegionInfo specifies the name of a region (in some RegionNameFormat) and the bounds of that region as RegionBounds.

Instances

Instances details
Read RegionInfo Source # 
Instance details

Defined in Data.EBird.API.Regions

Show RegionInfo Source # 
Instance details

Defined in Data.EBird.API.Regions

Eq RegionInfo Source # 
Instance details

Defined in Data.EBird.API.Regions

FromJSON RegionInfo Source #

Explicit instance for compatibility with their field names

Instance details

Defined in Data.EBird.API.Regions

ToJSON RegionInfo Source #

Explicit instance for compatibility with their field names

Instance details

Defined in Data.EBird.API.Regions

(k ~ A_Lens, a ~ Maybe RegionBounds, b ~ Maybe RegionBounds) => LabelOptic "bounds" k RegionInfo RegionInfo a b Source # 
Instance details

Defined in Data.EBird.API.Regions

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "name" k RegionInfo RegionInfo a b Source # 
Instance details

Defined in Data.EBird.API.Regions

data RegionBounds Source #

RegionBounds specify the corners of a bounding box around a region.

Instances

Instances details
Read RegionBounds Source # 
Instance details

Defined in Data.EBird.API.Regions

Show RegionBounds Source # 
Instance details

Defined in Data.EBird.API.Regions

Eq RegionBounds Source # 
Instance details

Defined in Data.EBird.API.Regions

FromJSON RegionBounds Source #

Explicit instance for compatibility with their field names

Instance details

Defined in Data.EBird.API.Regions

ToJSON RegionBounds Source #

Explicit instance for compatibility with their field names

Instance details

Defined in Data.EBird.API.Regions

(k ~ A_Lens, a ~ Double, b ~ Double) => LabelOptic "maxX" k RegionBounds RegionBounds a b Source # 
Instance details

Defined in Data.EBird.API.Regions

(k ~ A_Lens, a ~ Double, b ~ Double) => LabelOptic "maxY" k RegionBounds RegionBounds a b Source # 
Instance details

Defined in Data.EBird.API.Regions

(k ~ A_Lens, a ~ Double, b ~ Double) => LabelOptic "minX" k RegionBounds RegionBounds a b Source # 
Instance details

Defined in Data.EBird.API.Regions

(k ~ A_Lens, a ~ Double, b ~ Double) => LabelOptic "minY" k RegionBounds RegionBounds a b Source # 
Instance details

Defined in Data.EBird.API.Regions

data RegionListEntry Source #

The data structure returned by the eBird SubregionListAPI and AdjacentRegionsAPI.

Instances

Instances details
Read RegionListEntry Source # 
Instance details

Defined in Data.EBird.API.Regions

Show RegionListEntry Source # 
Instance details

Defined in Data.EBird.API.Regions

Eq RegionListEntry Source # 
Instance details

Defined in Data.EBird.API.Regions

FromJSON RegionListEntry Source #

Explicit instance for compatibility with their field names

Instance details

Defined in Data.EBird.API.Regions

ToJSON RegionListEntry Source #

Explicit instance for compatibility with their field names

Instance details

Defined in Data.EBird.API.Regions

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "name" k RegionListEntry RegionListEntry a b Source # 
Instance details

Defined in Data.EBird.API.Regions

(k ~ A_Lens, a ~ Region, b ~ Region) => LabelOptic "region" k RegionListEntry RegionListEntry a b Source # 
Instance details

Defined in Data.EBird.API.Regions

Optics for region-related API types

attoparsec parsers

parseRegionCode :: Parser RegionCode Source #

Parse an eBird API region code, which is a comma-separated list of one or more regions. To avoid the partial behavior of converting a sepBy1 result into a NonEmpty, we manually parse the first region followed by an optional tail.

parseRegion :: Parser Region Source #

Parse an eBird API region. This parser only ensures that the input is somewhat well-formed, in that it is either:

  • A Location region (an 'L' followed by an integral number)
  • The World region (just the string "world")
  • A Subnational2 region (formatted as "LETTERS-LETTERS-NUMBER" where LETTERS is one or more letters in any case, and NUMBERS is an integral number)
  • A Subnational1 region (formatterd as "LETTERS-LETTERS")
  • A Country region (just "LETTERS")