google-search-0.1.0.1: EDSL for Google and GMail search expressions

Safe HaskellNone

Language.Google.Search.Simple

Contents

Description

An orphan lives in this module,

 instance (Functor f, IsString a) => IsString (Free f a)

so that we can write "simple queries" :: Simple.

Synopsis

Units

data Duration Source

Constructors

Days 
Months 
Years 

Instances

data Size Source

Constructors

Bytes 
KBytes 
MBytes 

Instances

Search expression construction

data PrecBuilder Source

Builder with precedence, though ambiguous associativity. (But that's okay because Google doesn't mind which way you lean.)

Note that at Google OR binds tighter than conjunction, which is flipped in contrast to everywhere else. We take the analogous Haskell fixities when building search expressions:

  • 11: atomic tokens or parenthesised expressions
  • 10: complementation, search operators (cf. Haskell prefix application)
  • 3: disjunction (OR or |)
  • 2: conjunction (by juxtaposition)

Constructors

PrecBuilder Int Builder 

Instances

parentheses :: Int -> ((PrecBuilder -> Builder) -> Builder) -> PrecBuilderSource

Give me the precedence of the piece of syntax you're building, and I'll give you a function that parenthesise any sub-expressions when necessary.

class SearchBuilder e whereSource

Render a search expression using Google search syntax.

Generalised Boolean operators

class DisjunctF f whereSource

Methods

disjunctF :: e -> e -> f eSource

Instances

class Disjunct e whereSource

Methods

(\/) :: e -> e -> eSource

Instances

DisjunctF f => Disjunct (Free f a) 

class ConjunctF f whereSource

Methods

conjunctF :: e -> e -> f eSource

Instances

class Conjunct e whereSource

Methods

(/\) :: e -> e -> eSource

Instances

ConjunctF f => Conjunct (Free f a) 

class ComplementF f whereSource

Methods

complementF :: e -> f eSource

class Complement e whereSource

Methods

notB :: e -> eSource

Instances

andB :: Conjunct e => [e] -> eSource

andB is to /\ what and is to &&.

orB :: Disjunct e => [e] -> eSource

orB is to \/ what or is to ||.

Primitive Terms

data Term t Source

Fuzzy terms are grouped with parentheses (if necessary), while Exact terms are always “double-quoted”. The IsString instance defaults to Fuzzy, so just writing "literal string" ∷ Term Text is acceptable.

Constructors

Fuzzy t 
Exact t 

Boolean expressions

data BooleanF e Source

The shape of Boolean expressions.

Constructors

NotB e 
e AndB e 
e OrB e 

type BooleanM = Free BooleanFSource

The free Boolean-shaped monad. No refunds.

type Simple = BooleanM (Term Text)Source

Simple Boolean combinations of Terms.