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

Safe HaskellNone
LanguageHaskell98

Data.PhoneNumber

Contents

Synopsis

Types

data PhoneNumber Source

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

data PhoneNumberRef Source

An opaque pointer to a PhoneNumberRef C++ class

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.

Parsing

parsePhoneNumber Source

Arguments

:: ByteString

The phone number to parse

-> ByteString

A two letter country code for the default region to be assumed

-> Either PhoneNumberParseError PhoneNumber 

Try to parse a phone number, building a PhoneNumber including commonly accessed information.

This is marginally more expensive than parsing a PhoneNumberRef with parsePhoneNumberRef and extracting just the fields that you need, although the latter will allow you to retrieve more information such as the type of number (which requires more underlying library calls).

parsePhoneNumberRef Source

Arguments

:: ByteString

The phone number to parse

-> ByteString

A two letter country code for the default region to be assumed

-> Either PhoneNumberParseError PhoneNumberRef 

Try to parse a PhoneNumberRef, see the PhoneNumberRef accessors/utilities section below for useful things to do with the result.

PhoneNumberRef accessors/utilities

Utility

convertAlphaCharacters :: ByteString -> ByteString Source

Convert any alpha characters in a phone number to their equivalent keypad numbers.