phone-numbers-0.0.2: Haskell bindings to the libphonenumber library

Safe HaskellNone
LanguageHaskell98

Data.PhoneNumber.LowLevel

Contents

Description

Low level phone number handling, more closely matches the underlying libphonenumber API.

Synopsis

Data types

data PhoneNumber Source

A data type representation of a phone number, you can build one of these with copyPhoneNumberRef.

data PhoneNumberParseError Source

There was a problem parting your phone number. For now, if you want to know what the Int here means, you'll need to look at the ErrorType enum in the underlying library.

data PhoneNumberUtil Source

An opaque pointer to the (singleton) PhoneNumberUtil C++ class

References and parsing

getPhoneNumberUtil :: IO PhoneNumberUtil Source

Grab the singleton PhoneNumberUtil class instance, needed to do useful things with libphonenumber

newPhoneNumberRef :: IO PhoneNumberRef Source

Create a mutable reference to a PhoneNumber (C++ class) instance.

parsePhoneNumber Source

Arguments

:: PhoneNumberUtil

The singleton PhoneNumberUtil reference

-> PhoneNumberRef

The reference to be mutably updated

-> ByteString

The bytestring to parse as a phone number

-> ByteString

The default region to assume numbers are from, if ambiguous. e.g. AU for Australia

-> IO (Either PhoneNumberParseError ()) 

Parse a phone number.

Extracting usable information

copyPhoneNumberRef :: PhoneNumberRef -> IO PhoneNumber Source

Copy fields from a PhoneNumberRef and create a PhoneNumber

getCountryCode :: PhoneNumberRef -> IO (Maybe Word64) Source

Read the country code from a PhoneNumberRef

getNationalNumber :: PhoneNumberRef -> IO (Maybe Word64) Source

Read the national number (the phone number itself) from a PhoneNumberRef

getExtension :: PhoneNumberRef -> IO (Maybe ByteString) Source

Read the extension (e.g. 12345678x123) from a PhoneNumberRef