microformats2-types-0.1.0: Microformats 2 types for Haskell.

Safe HaskellNone

Data.Microformats2

Description

Microformats 2 types for Haskell.

Notes:

  1. Pretty much all properties in MF2 are optional -- this is why we use Maybe when lists don't make sense.
  2. We don't duplicate sub-properties in parent types. E.g. h-adr has both p-geo and p-latitude, p-longitude, p-altitude. Adr only has an Embedded Geo.
  3. Lazy Text is used for storing texts, because it's the format used in Scotty, Hastache and other popular web libraries.

Synopsis

Documentation

type Link a = TextSource

An alias for lazy Text as a phantom type for storing the type of linked data.

data Embedded a Source

A type that represents all the ways Microformats objects can be embedded inside one another.

Constructors

Here a 
Somewhere (Link a) 
Nowhere 

Instances

Typeable1 Embedded 
Eq a => Eq (Embedded a) 
Data a => Data (Embedded a) 
Show a => Show (Embedded a) 
ToJSON a0 => ToJSON (Embedded a0) 
FromJSON a0 => FromJSON (Embedded a0) 

hereFromMaybe :: Maybe a -> Embedded aSource

Converts a Maybe thing to an Embedded wrapping the same thing.

somewhereFromMaybe :: Maybe (Link a) -> Embedded aSource

Converts a Maybe Link to an Embedded referencing the same URL.

defaultGeo :: GeoSource

An empty Geo.

defaultAdr :: AdrSource

An empty Adr.

defaultCard :: CardSource

An empty Card.

defaultCite :: CiteSource

An empty Cite.

type LocationReference = Either (Embedded Card) (Embedded Adr)Source

A location reference. Left means a Card is used, which is often used for checkins. Right means an Adr is used. If you only have a Geo, wrap it in an Adr.

type EntryReference = Either (Embedded Cite) (Link Entry)Source

An Entry reference.

defaultEntry :: EntrySource

An empty Entry.