database-study-0.0.1: Demonstrate how a database can be implemented the functional way

Example.QueryMonad

Description

some queries implemented using the list monad

A special Table type instead of plain lists could provide an efficient implementation.

Synopsis

Documentation

employees :: [Emp]Source

all employees

clerks :: [Emp]Source

all clerks

richClerks :: [Emp]Source

all clerks with salary at least 1000

researchers :: [Emp]Source

all employees in research department

managers :: [(String, String)]Source

names of all employees and their managers if the employee has a manager so far

managers0 :: [(String, String)]Source

names of all employees and their managers; if the employee has no manager, return an empty string

realManagers :: [String]Source

names of managers that have at least one employee

realManagersFull :: [Emp]Source

managers that have at least one employee

realManagersSortedFull :: [Emp]Source

managers that have at least one employee, sorted by their names.

maximumSalary :: IntSource

maximum salary amongst all employees

richestEmployee :: EmpSource

employee with maximum salary without a back-join

teams :: [(String, [String])]Source

employees grouped by their managers implemented with a sub-query

teams0 :: [(String, [String])]Source

employees grouped by their managers implemented with a GROUP BY

averageSalariesInDepartments :: [(String, Int)]Source

average salary in each department

managerOfLargestTeam :: (String, Int)Source

manager with most employees

teamSalaries0 :: [(String, Int)]Source

A recursive query: Compute the total salary for each manager and the total set of employees he conducts.