hunt-searchengine- A search and indexing engine.

Safe HaskellNone



Common types used within Hunt.



type URI = Text Source

The URI describing the location of the original document.

type Description = DocDesc Source

The description of a document is a generic key value map.

type Title = Text Source

The title of a document.

type Content = Text Source

The content of a document.

type Position = Int Source

The position of a word in the document.

type Context = Text Source

The name of a context.

type Word = Text Source

A single word.

type Words = Map Context WordList Source

Positions of Words for each context.

type WordList = Map Word [Position] Source

Positions of words in the document.

type Weight = Score Source

Weight (for ranking).

type RegEx = Text Source

Regular expression.

newtype Score Source

The score of a hit (either a document hit or a word hit). type Score = Float

Weight or score of a documents, 0.0 indicates: not set, so there is no need to work with Maybe's wrapped in newtype to not mix up with Score's and Weight's in documents




unScore :: Float


Eq Score 
Fractional Score 
Num Score 
Ord Score 
Show Score 
ToJSON Score 
FromJSON Score 
Monoid Score 
Binary Score 
NFData Score 
Aggregate ScoredOccs Score

aggregate scored occurences to a score by aggregating first the positions and snd the doc ids

used in computing the score of word in completion search

Aggregate ScoredDocs Score

aggregate scored docs to a single score by summing up the scores and throw away the DocIds

class Monoid a where

The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:

  • mappend mempty x = x
  • mappend x mempty = x
  • mappend x (mappend y z) = mappend (mappend x y) z
  • mconcat = foldr mappend mempty

The method names refer to the monoid of lists under concatenation, but there are many other instances.

Minimal complete definition: mempty and mappend.

Some types can be viewed as a monoid in more than one way, e.g. both addition and multiplication on numbers. In such cases we often define newtypes and make those instances of Monoid, e.g. Sum and Product.

Minimal complete definition

mempty, mappend


mempty :: a

Identity of mappend

mappend :: a -> a -> a

An associative operation

mconcat :: [a] -> a

Fold a list using the monoid. For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.


Monoid Ordering 
Monoid () 
Monoid ByteString 
Monoid Builder 
Monoid ByteString 
Monoid Text 
Monoid Text 
Monoid More 
Monoid All 
Monoid Any 
Monoid IntSet 
Monoid DocIdSet 
Monoid Score 
Monoid Positions 
Monoid WordInfoAndHits 
Monoid WordInfo 
Monoid ScoredRawDocs 
Monoid ScoredOccs 
Monoid ScoredWords 
Monoid UnScoredDocs 
Monoid ScoredDocs 
Monoid [a] 
Monoid a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S." Since there is no "Semigroup" typeclass providing just mappend, we use Monoid instead.

Monoid (Result a) 
Monoid (Parser a) 
Monoid a => Monoid (Dual a) 
Monoid (Endo a) 
Num a => Monoid (Sum a) 
Num a => Monoid (Product a) 
Monoid (First a) 
Monoid (Last a) 
Monoid (IntMap a) 
Ord a => Monoid (Set a) 
Monoid (Seq a) 
Monoid a => Monoid (RTree a) 
Monoid a => Monoid (RTree a) 
Monoid (DList a) 
(Hashable a, Eq a) => Monoid (HashSet a) 
Monoid (Vector a) 
Unbox a => Monoid (Vector a) 
Storable a => Monoid (Vector a) 
Prim a => Monoid (Vector a) 
Monoid v => Monoid (DocIdMap v) 
Monoid a => Monoid (ScoredCx a) 
Monoid b => Monoid (a -> b) 
(Monoid a, Monoid b) => Monoid (a, b) 
(Eq k, Hashable k) => Monoid (HashMap k v) 
Ord k => Monoid (Map k v) 
Monoid (Parser i a) 
Monoid a => Monoid (Const a b) 
Monoid (Proxy * s) 
Typeable (* -> Constraint) Monoid 
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) 
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) 
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) 

(<>) :: Monoid m => m -> m -> m infixr 6

An infix synonym for mappend.