Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides functions to make values out of a registry. The general algorithm is the following
- for a given value type search in the existing list of values a value with the same type. If found return it
- if not found search a function having the desired output type if found, now try to recursively make all the input parameters. Keep a stack of the current types trying to be built.
- when trying to make an input parameter if the current input type is already in the types trying to be built then there is a cycle. Return an error in that case
- when a value has been constructed place it on top of the existing value list so that it can be reused by other functions
Synopsis
- make :: forall a ins out. Typeable a => Registry ins out -> a
- makeSafe :: forall a ins out. (Typeable a, Solvable ins out) => Registry ins out -> a
- makeEither :: forall a ins out. Typeable a => Registry ins out -> Either Text a
- makeSpecialized :: forall a b ins out. (Typeable a, Typeable b) => Registry ins out -> b
- makeSpecializedPath :: forall path b ins out. (PathToTypeReps path, Typeable b) => Registry ins out -> b
- makeSpecializedEither :: forall a b ins out. (Typeable a, Typeable b) => Registry ins out -> Either Text b
- makeSpecializedPathEither :: forall path b ins out. (PathToTypeReps path, Typeable b) => Registry ins out -> Either Text b
- makeEitherWithContext :: forall a ins out. Typeable a => Context -> Registry ins out -> Either Text a
Documentation
make :: forall a ins out. Typeable a => Registry ins out -> a Source #
Make an element of type a
out of the registry
makeSafe :: forall a ins out. (Typeable a, Solvable ins out) => Registry ins out -> a Source #
Make an element of type a
out of the registry
and check statically that the element can be built
makeEither :: forall a ins out. Typeable a => Registry ins out -> Either Text a Source #
Make an element of type a
out of the registry, for a registry
which was possibly created with +:
SPECIALIZED VALUES
makeSpecialized :: forall a b ins out. (Typeable a, Typeable b) => Registry ins out -> b Source #
make for specialized values
makeSpecializedPath :: forall path b ins out. (PathToTypeReps path, Typeable b) => Registry ins out -> b Source #
make for specialized values
makeSpecializedEither :: forall a b ins out. (Typeable a, Typeable b) => Registry ins out -> Either Text b Source #
makeEither for specialized values, in case you are using an unchecked registry
makeSpecializedPathEither :: forall path b ins out. (PathToTypeReps path, Typeable b) => Registry ins out -> Either Text b Source #
makeEither for specialized values along a path, in case you are using an unchecked registry