hs-vcard-0.1: Implements the RFC 2426 vCard 3.0 spec




This package implements the RFC 2426 vCard 3.0 spec (http://www.ietf.org/rfc/rfc2426.txt)

Its usage is fairly simple and intuitive. For example, below is how one would produce a VCard for Frank Dawson, one of the RFC 2426 authors:

 VCard  "Frank Dawson"
        (IndividualNames ["Dawson"] ["Frank"] [] [] [])
        [ Organization ["Lotus Development Corporation"]
        , Address [AddrWork, AddrPostal, AddrParcel] "" ""
                    "6544 Battleford Drive"
                    "Raleigh" "NC" "27613-3502" "U.S.A"
        , Telephone [TelVoice, TelMessage, TelWork] "+1-919-676-9515"
        , Telephone [TelFax, TelWork] "+1-919-676-9564"
        , Email [EmailInternet, EmailPreferred] "Frank_Dawson@Lotus.com"
        , Email [EmailInternet] "fdawson@earthlink.net"
        , URL "http://home.earthlink.net/~fdawson"

Although this package is fairly well documented, even with general explanations about the various VCard properties, RFC 2426 should be consulted for the final say on the meaning or application of any of the VCard properties.

data VCard Source

Calling show on VCard will output a RFC 2426-compliant VCard that can, for example, be easily saved to a file and imported by any supporting program.


type CommonName = StringSource

Common name of the represented person. E.g.,

 CommonName "Mr. Michael A. F. Schade"

data IndividualNames Source

A breakdown of the vCard entity's name, corresponding, in sequence, to Family Name, Given Name, Additional Names, Honorific Prefixes, and Honorific Suffixes. E.g.,

 IndividualNames ["Schade"] ["Michael"] ["Anthony", "Fanetti"] [] ["Esq."]

data VCardProperty Source


Nickname [String]

A list of nicknames belonging to the VCard entity. E.g.,

 Nickname ["Mike", "Mikey"]

A photo of the VCard entity. E.g.,

 Photo Nothing (URI "http://accentuate.us/smedia/images/michael.jpg")


phtType :: Maybe String

Registered IANA format

phtData :: Data
Birthday UTCTime

Specifies the birth date of the VCard entity. E.g.,

 Birthday $ UTCTime (fromGregorian 1991 10 14) (secondsToDiffTime 0)

A physical address associated with the vCard entity. E.g.,

 Address [AddrParcel, AddrPostal] "PO Box 935" "" "" "Fenton" "MO"
                                  "63026" "USA"

Formatted text about the delivery address. This is typically similar to the information in Address. E.g.,

 Label  [AddrParcel, AddrPostal]
        ["Michael Schade", "PO Box 935", "Fenton, MO 63026"]


lblType :: [AddrType]
label :: [String]

Will be newline separated


A telephone number for the VCard entity, as well as a list of properties describing the telephone number. E.g.,

 Telephone [TelCell, TelPreferred] "+1-555-555-5555"


telType :: [TelType]
number :: String

An email address for the VCard entity, including a list of properties describing it. E.g.,

 Email [EmailInternet, EmailPreferred] "hackage@mschade.me"


emailType :: [EmailType]
email :: String
Mailer String

Specifies the mailing agent the vCard entity uses. E.g.,

 Mailer "MichaelMail 4.2" -- Not a real mailing agent, unfortunately :(
TZ TimeZone

Represents the time zone of the vCard entity. E.g.,

 TZ (hoursToTimeZone (-6))
Geo (Double, Double)

Relates to the global positioning of the vCard entity. The value is (latitude, longitude) and must be specified as decimal degrees, preferably to six decimal places.

 Geo (37.386013, -122.082932)
Title String

The VCard entity's job title or other position. E.g.,

 Title "Co-Founder"
Role String

Specifies the role associated with the title. E.g.,

 Role "Anything"   -- For the co-founder, or
 Role "Programmer" -- For someone the title "Research and Development"

An image of the vCard entity's logo. This would typically relate to their organization. E.g.,

 Logo Nothing (URI "http://spearheaddev.com/smedia/images/logo-trans.png")


lgoType :: Maybe String

Registered IANA format

lgoData :: Data
Agent AgentData

Indicates the vCard of an assistant or area administrator who is typically separately addressable. E.g.,

 Agent (AgentURI "CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com")


 Agent (AgentVCard (VCard   [ CommonName "James Q. Helpful"
                            , Email [EmailInternet] "j@spearheaddev.com"
Organization [String]

The organization to which an entity belongs followed by organizational unit names. E.g.,

 Organization ["Spearhead Development, L.L.C.", "Executive"]
Categories [String]

General categories to describe the vCard entity. E.g.,

 Categories ["Internet", "Web Services", "Programmers"]
Note String

A general note about the vCard entity. E.g.,

 Note "Email is the absolute best contact method."
ProductId String

Specifies the identifier of the product that created this vCard. E.g.,

 ProductId "-//ONLINE DIRECTORY//NONSGML Version 1//EN"

Please note well that, by RFC 2426 guidelines, "implementations SHOULD use a method such as that specified for Formal Public Identifiers in ISO 9070 to assure that the text value is unique," but this module does not support that.

Revision UTCTime

Distinguishes the current revision from other renditions. E.g.,

 Revision $ UTCTime (fromGregorian 2011 04 16) (secondsToDiffTime 0)
SortString String

Provides a locale- or national-language-specific formatting of the formatted name based on the vCard entity's family or given name. E.g.,

 SortString "Schade"

Specifies information in a digital sound format to annotate some aspect of the vCard. This is typically for the proper pronunciation of the vCard entity's name. E.g.,

 Sound  "BASIC"
        (URI "CID:JOHNQPUBLIC.part8.19960229T080000.xyzMail@host1.com")


sndType :: Maybe String

Registered IANA format

sndData :: Data
UID String

A value to uniquely identify the vCard. Please note well that this should be one of the registered IANA formats, but as of this time, this module does not support listing the UID type. E.g.,

 UID "19950401-080045-40000F192713-0052"
URL String

A website associated with the vCard entity. E.g.,

 URL "http://spearheaddev.com/"
Class Class

Describes the general intention of the vCard owner as to how accessible the included information should be. E.g.,

 Class ClassConfidential

Specifies a public key or authentication certificate associated with the vCard entity. E.g.,

 Key "x509" (Binary "dGhpcyBjb3VsZCBiZSAKbXkgY2VydGlmaWNhdGUK")


keyType :: Maybe String

Registered IANA format

keyData :: Data


data AddrType Source

Represents the various types or properties of an address.


data TelType Source

Represents the various types or properties of a telephone number.


data EmailType Source

Represents the various types or properties of an email address.


data AgentData Source

Represents the data associated with a vCard's Agent. This could be a URI to such a vCard or the embedded contents of the vCard itself.


data Data Source

Represents the various types of data that can be included in a vCard.


URI String 
Binary String 


data Class Source

Classifies the vCard's intended access level.