microformats2-types-0.3.0: Microformats 2 types (with Aeson instances)

Safe HaskellTrustworthy
LanguageHaskell2010

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 = Text Source

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

Eq a => Eq (Embedded a) 
Data a => Data (Embedded a) 
Show a => Show (Embedded a) 
ToJSON a0 => ToJSON (Embedded a) 
FromJSON a0 => FromJSON (Embedded a) 
Typeable (* -> *) Embedded 

hereFromMaybe :: Maybe a -> Embedded a Source

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

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

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

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.

type ContentReference = Either Pandoc Text Source

A content reference.