Copyright | (c) 2023 Finley McIlwaine |
---|---|
License | MIT (see LICENSE) |
Maintainer | Finley McIlwaine <finleymcilwaine@gmail.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.EBird.API.EBirdString
Contents
Description
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.
Methods
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
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.