Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Parameter a where
- data Tree a
- drawTree :: Show a => Tree a -> String
- foldi :: (a -> b -> b) -> (b -> b -> b) -> b -> Tree a -> b
- foldi1 :: (a -> a -> a) -> Tree a -> a
- fromListL :: NonEmpty a -> Tree a
- data Ap a = Ap {
- result :: NonEmpty Dynamic
- applicationTree :: Tree a
- data ApResult (env :: * -> *) a
- type ApResultPure a = ApResult Identity a
- papply :: forall env a. (Parameter a, Monad env, Typeable env) => ApResult env a -> ApResult env a -> ApResult env a
- applyTree :: forall env a. (Parameter a, Monad env, Typeable env) => Tree a -> ApResult env a
- pureApplyTree :: Parameter a => Tree a -> ApResultPure a
- applyList :: forall env a. (Parameter a, Monad env, Typeable env) => a -> [a] -> ApResult env a
- pureApplyList :: Parameter a => a -> [a] -> ApResultPure a
- reifyTree :: forall env result a. (Parameter a, Monad env, Typeable env, Typeable result) => Tree a -> Either (ApResult env a) (NonEmpty (env result))
- pureReifyTree :: forall result a. (Parameter a, Typeable result) => Tree a -> Either (ApResultPure a) (NonEmpty result)
- reifyList :: forall env result a. (Parameter a, Monad env, Typeable env, Typeable result) => a -> [a] -> Either (ApResult env a) (NonEmpty (env result))
- pureReifyList :: forall result a. (Parameter a, Typeable result) => a -> [a] -> Either (ApResultPure a) (NonEmpty result)
Types and Typeclasses
class Parameter a where Source #
The Parameter
typeclass is used to represent dynamic functions and
their parameters.
Tree
is a simple "leafy" tree, used to build and express chains of
function applications. Note that it is non-empty by construction.
Instances
drawTree :: Show a => Tree a -> String Source #
Utility function to give a visual representation of the Tree'
s
structure.
:: (a -> b -> b) | accumulating function |
-> (b -> b -> b) | function to combine the values of two evaluated subtrees, taking the left branch as the first argument and the right branch as the second |
-> b | initial accumulator value |
-> Tree a | |
-> b |
An "inward" fold on a Tree
where subtrees of each branch are fully evaluated, and
then those values are combined with the given binary operation.
foldi1 :: (a -> a -> a) -> Tree a -> a Source #
An "inward" fold on a Tree
where subtrees of each branch are fully evaluated, and
then those values are combined with the accumulating function. Uses the
values at each leaf for initial accumulators.
fromListL :: NonEmpty a -> Tree a Source #
Left-associatively builds up a Tree
from a non-empty list.
Ap
represents a chain of successful function applications.
Ap | |
|
Instances
Show a => Show (Ap a) Source # | |
Generic (Ap a) Source # | |
type Rep (Ap a) Source # | |
Defined in Data.Dynamic.Resolve type Rep (Ap a) = D1 (MetaData "Ap" "Data.Dynamic.Resolve" "dynamic-resolution-0.1.0.0-EDdpoqUrAPbJ0BSuZMlv6Q" False) (C1 (MetaCons "Ap" PrefixI True) (S1 (MetaSel (Just "result") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NonEmpty Dynamic)) :*: S1 (MetaSel (Just "applicationTree") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Tree a)))) |
data ApResult (env :: * -> *) a Source #
ApResult
represents a chain of function applications (in the "env"
monad) that may have failed.
Success (Ap a) | successful application and the resulting value |
Failure (Ap a, Ap a) | failed application, the initial value, and the value attempted to be applied |
Instances
Show a => Show (ApResult env a) Source # | |
Generic (ApResult env a) Source # | |
type Rep (ApResult env a) Source # | |
Defined in Data.Dynamic.Resolve type Rep (ApResult env a) = D1 (MetaData "ApResult" "Data.Dynamic.Resolve" "dynamic-resolution-0.1.0.0-EDdpoqUrAPbJ0BSuZMlv6Q" False) (C1 (MetaCons "Success" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ap a))) :+: C1 (MetaCons "Failure" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ap a, Ap a)))) |
type ApResultPure a = ApResult Identity a Source #
ApResult
specialized to pure funtcion applications
Resolution functions
applyTree :: forall env a. (Parameter a, Monad env, Typeable env) => Tree a -> ApResult env a Source #
Evaluates a Tree
of Parameter
s to a single ApResult
. Will
automatically lift Dynamic
functions and arguments into the env monad
(must be specified with visible type application) as needed—if this is
undesirable use pureApplyTree
.
pureApplyTree :: Parameter a => Tree a -> ApResultPure a Source #
:: Parameter a | |
=> a | function |
-> [a] | arguments |
-> ApResultPure a |
reifyTree :: forall env result a. (Parameter a, Monad env, Typeable env, Typeable result) => Tree a -> Either (ApResult env a) (NonEmpty (env result)) Source #
Evaluates a Tree
of Parameter
s to a value of type "env result" if
successful, or the application information if not. Will automatically
lift Dynamic
functions and arguments into the env monad as needed—if
this is undesirable use pureReifyTree
.
pureReifyTree :: forall result a. (Parameter a, Typeable result) => Tree a -> Either (ApResultPure a) (NonEmpty result) Source #
:: (Parameter a, Monad env, Typeable env, Typeable result) | |
=> a | function |
-> [a] | arguments |
-> Either (ApResult env a) (NonEmpty (env result)) |
Evaluates the given function (as a Parameter
) applied to a list of
arguments (also as Parameter
s) to a value of type "env result" if
successful, or the application information if not. Will automatically
lift Dynamic
functions and arguments into the env monad as needed—if
this is undesirable use pureReifyList
.
pureReifyList :: forall result a. (Parameter a, Typeable result) => a -> [a] -> Either (ApResultPure a) (NonEmpty result) Source #