dynamic-resolution-0.1.0.0: Utilities for 'compiling' trees of Dynamics into statically typed values

Safe HaskellNone
LanguageHaskell2010

Data.Dynamic.Resolve.Util

Contents

Synopsis

Utilities for working with Dynamics

dynCons Source #

Arguments

:: Dynamic

value to cons

-> Dynamic

list to cons to

-> Maybe Dynamic 

Cons a Dynamic value to a Dynamic list of values of the same type.

dynPure :: forall env. (Applicative env, Typeable env) => Dynamic -> Dynamic Source #

Apply pure to a value inside a Dynamic. Note that the type of Applicative you want to return must be manually specified with visible type application.

dynJoin :: forall env. (Monad env, Typeable env) => Dynamic -> Maybe Dynamic Source #

Apply join to a value inside a Dynamic. Note that the type of Monad you want to return must be manually specified with visible type application.

dynPureJoinId :: forall env. (Monad env, Typeable env) => Dynamic -> Dynamic Source #

Normalizes a Dynamic value to an unnested monadic value in the env monad via applications of join, pure, or simply id as needed. Note that the type of Monad you want to return must be manually specified with visible type application.

dynEmptyList :: Dynamic -> Dynamic Source #

Returns an empty list (wrapped in Dynamic) of the same type as the value inside the given Dynamic.

dynMerge :: [Dynamic] -> Maybe Dynamic Source #

Turns a list of Dynamic values into a Dynamic list of values; that is to say it embeds the list of items inside a single Dynamic. Fails if all values are not of the same type or an empty list is provided.

dynMergeM :: forall f. (Monad f, Typeable f) => [Dynamic] -> Maybe Dynamic Source #

Turns a list of Dynamic values into a Dynamic list of values; that is to say it embeds the list of items inside a single Dynamic. Fails if all values are not of the same type or an empty list is provided. Takes a Monad type variable via visible type application to allow mixing wrapped and unwrapped values—use dynMerge if this is undesirable.

dynFmap Source #

Arguments

:: (Functor f, Typeable f) 
=> Dynamic

function

-> Dynamic

value

-> Maybe Dynamic 

fmap lifted to work with a Dynamic function and value. Fails if fmap would fail with the actual types of the function and value. Requires the desired Functor to be specified with visible type application.

dynAp Source #

Arguments

:: (Applicative f, Typeable f) 
=> Dynamic

function

-> Dynamic

value

-> Maybe Dynamic 

<*> lifted to work with a Dynamic function and value. Fails if <*> would fail with the actual types of the function and value. Requires the desired Applicative to be specified with visible type application.

dynApplyFmapAp Source #

Arguments

:: (Applicative f, Typeable f) 
=> Dynamic

function

-> Dynamic

value

-> Maybe Dynamic 

Applies a Dynamic function to a Dynamic value, utilizing fmap, pure, or <*> as needed if the function, the argument, or both are wrapped in an Applicative. Requires the desired Applicative to be specified with visible type application.