registry-0.1.0.2: data structure for assembling "components"

Safe HaskellSafe
LanguageHaskell2010

Data.Registry.Solver

Description

Type level functions to statically assess if a value can be built out of a Registry

For now we don't check if there could be cycles in the registry functions

Synopsis

Documentation

type family Inputs f :: [*] where ... Source #

Compute the list of input types for a function

Equations

Inputs (i -> o) = i ': Inputs o 
Inputs x = '[] 

type family Output f :: * where ... Source #

Compute the output type for a function

Equations

Output (i -> o) = Output o 
Output x = x 

type family Contains (a :: *) (els :: [*]) :: Constraint where ... Source #

Compute if a type is contained in a list of types

Equations

Contains a '[] = TypeError ((Text "No element of type " :<>: ShowType a) :<>: Text " can be build out of the registry") 
Contains a (a ': els) = () 
Contains a (b ': els) = Contains a els 

type (:-) out a = Contains a out Source #

Shorthand type alias when many such constraints need to be added to a type signature

class IsSubset (ins :: [*]) (out :: [*]) Source #

Compute if each element of a list of types is contained in another list

Instances
IsSubset ([] :: [*]) out Source # 
Instance details

Defined in Data.Registry.Solver

(Contains a out, IsSubset els out) => IsSubset (a ': els) out Source # 
Instance details

Defined in Data.Registry.Solver

class Solvable (ins :: [*]) (out :: [*]) Source #

From the list of all the input types and outputs types of a registry Can we create all the output types?

Instances
IsSubset ins out => Solvable ins out Source # 
Instance details

Defined in Data.Registry.Solver

type family (x :: [k]) :++ (y :: [k]) :: [k] where ... Source #

Extracted from the typelevel-sets project and adapted for the Registry datatype | This union deduplicates elements only if they appear in contiguously:

Equations

'[] :++ xs = xs 
(x ': xs) :++ ys = x ': (xs :++ ys)