discrimination-0.1: Fast generic linear-time sorting, joins and container construction.

Safe HaskellSafe
LanguageHaskell2010

Data.Discrimination.Class

Contents

Synopsis

Documentation

class Decidable f => Discriminating f where Source

Methods

disc :: f a -> [(a, b)] -> [[b]] Source

Joins

joining Source

Arguments

:: Discriminating f 
=> f d

the discriminator to use

-> ([a] -> [b] -> c)

how to join two tables

-> (a -> d)

selector for the left table

-> (b -> d)

selector for the right table

-> [a]

left table

-> [b]

right table

-> [c] 

O(n). Perform a full outer join while explicit merging of the two result tables a table at a time.

The results are grouped by the discriminator.

inner Source

Arguments

:: Discriminating f 
=> f d

the discriminator to use

-> (a -> b -> c)

how to join two rows

-> (a -> d)

selector for the left table

-> (b -> d)

selector for the right table

-> [a]

left table

-> [b]

right table

-> [[c]] 

O(n). Perform an inner join, with operations defined one row at a time.

The results are grouped by the discriminator.

This takes operation time linear in both the input and result sets.

outer Source

Arguments

:: Discriminating f 
=> f d

the discriminator to use

-> (a -> b -> c)

how to join two rows

-> (a -> c)

row present on the left, missing on the right

-> (b -> c)

row present on the right, missing on the left

-> (a -> d)

selector for the left table

-> (b -> d)

selector for the right table

-> [a]

left table

-> [b]

right table

-> [[c]] 

O(n). Perform a full outer join with operations defined one row at a time.

The results are grouped by the discriminator.

This takes operation time linear in both the input and result sets.

leftOuter Source

Arguments

:: Discriminating f 
=> f d

the discriminator to use

-> (a -> b -> c)

how to join two rows

-> (a -> c)

row present on the left, missing on the right

-> (a -> d)

selector for the left table

-> (b -> d)

selector for the right table

-> [a]

left table

-> [b]

right table

-> [[c]] 

O(n). Perform a left outer join with operations defined one row at a time.

The results are grouped by the discriminator.

This takes operation time linear in both the input and result sets.

rightOuter Source

Arguments

:: Discriminating f 
=> f d

the discriminator to use

-> (a -> b -> c)

how to join two rows

-> (b -> c)

row present on the right, missing on the left

-> (a -> d)

selector for the left table

-> (b -> d)

selector for the right table

-> [a]

left table

-> [b]

right table

-> [[c]] 

O(n). Perform a right outer join with operations defined one row at a time.

The results are grouped by the discriminator.

This takes operation time linear in both the input and result sets.