Copyright | (c) 2023 Finley McIlwaine |
---|---|
License | MIT (see LICENSE) |
Maintainer | Finley McIlwaine <finleymcilwaine@gmail.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The EBirdString
class contains types whose values may be represented as
strings compatible with the eBird API.
Synopsis
- class EBirdString a where
- toEBirdString :: a -> Text
- fromEBirdString :: Text -> Either Text a
- unsafeFromEBirdString :: (HasCallStack, EBirdString a) => Text -> a
The class
class EBirdString a where Source #
A convenience class for converting the litany of eBird API types to and from their respective eBird API compatible string representations.
toEBirdString :: a -> Text Source #
Convert a value to an eBird string.
fromEBirdString :: Text -> Either Text a Source #
Parse a string into an eBird value. If parsing fails, this should result
in Left
with an error message.
Instances
EBirdString SortChecklistsBy Source # | The eBird string for a |
Defined in Data.EBird.API.Checklists | |
EBirdString CSVOrJSONFormat Source # | The eBird string of a |
Defined in Data.EBird.API.Hotspots | |
EBirdString DetailLevel Source # | The eBird string for a |
Defined in Data.EBird.API.Observations toEBirdString :: DetailLevel -> Text Source # fromEBirdString :: Text -> Either Text DetailLevel Source # | |
EBirdString SelectObservation Source # | The eBird string for a |
Defined in Data.EBird.API.Observations | |
EBirdString SortObservationsBy Source # | The eBird string for a |
Defined in Data.EBird.API.Observations | |
EBirdString RankTop100By Source # | The eBird string for a |
Defined in Data.EBird.API.Product toEBirdString :: RankTop100By -> Text Source # fromEBirdString :: Text -> Either Text RankTop100By Source # | |
EBirdString Region Source # | A
|
Defined in Data.EBird.API.Regions | |
EBirdString RegionCode Source # | A |
Defined in Data.EBird.API.Regions toEBirdString :: RegionCode -> Text Source # fromEBirdString :: Text -> Either Text RegionCode Source # | |
EBirdString RegionNameFormat Source # | A |
Defined in Data.EBird.API.Regions | |
EBirdString RegionType Source # | Results in eBird region type format |
Defined in Data.EBird.API.Regions toEBirdString :: RegionType -> Text Source # fromEBirdString :: Text -> Either Text RegionType Source # | |
EBirdString SPPGrouping Source # | The eBird string of an |
Defined in Data.EBird.API.Taxonomy toEBirdString :: SPPGrouping -> Text Source # fromEBirdString :: Text -> Either Text SPPGrouping Source # | |
EBirdString SPPLocale Source # | The eBird strings of the species locales are simply the lowercase constructor names. |
Defined in Data.EBird.API.Taxonomy | |
EBirdString SpeciesCode Source # | The eBird string of a |
Defined in Data.EBird.API.Taxonomy toEBirdString :: SpeciesCode -> Text Source # fromEBirdString :: Text -> Either Text SpeciesCode Source # | |
EBirdString SpeciesCodes Source # | The eBird string of a |
Defined in Data.EBird.API.Taxonomy toEBirdString :: SpeciesCodes -> Text Source # fromEBirdString :: Text -> Either Text SpeciesCodes Source # | |
EBirdString TaxonomyCategories Source # | The eBird string of a |
Defined in Data.EBird.API.Taxonomy | |
EBirdString TaxonomyCategory Source # | The eBird strings of the taxonomy categories are simply the lowercase constructor names. |
Defined in Data.EBird.API.Taxonomy | |
EBirdString EBirdDate Source # | eBird dates are formatted as YYYY-MM-DD, with 0 padding where necessary. |
Defined in Data.EBird.API.Util.Time | |
EBirdString EBirdDateTime Source # | eBird datetimes are formatted as YYYY-MM-DD HH:MM, with 0 padding where necessary. |
Defined in Data.EBird.API.Util.Time toEBirdString :: EBirdDateTime -> Text Source # fromEBirdString :: Text -> Either Text EBirdDateTime Source # | |
EBirdString EBirdTime Source # | eBird times are formatted as HH:MM, with 0 padding where necessary. |
Defined in Data.EBird.API.Util.Time |
Unsafe interface
unsafeFromEBirdString :: (HasCallStack, EBirdString a) => Text -> a Source #
Parse a string into an eBird value unsafely.
Be careful! This can result in runtime errors if the string is malformatted.