# Specular.FRP

- Package
- purescript-specular
- Repository
- restaumatic/purescript-specular

## Re-exports from **Specular.**FRP.Base

### #Event Source

`newtype Event a`_{}

A source of occurences.

During a frame, an Event occurs at most once with a value of type a.

Event is a functor. It is not, however, an Applicative. There is no
meaningful interpretation of `pure`

(when would the event occur?).
There is an interpretation of `apply`

(Event that fires when the input
events coincide), but it's not very useful.

#### Instances

### #Dynamic Source

### #MonadFRP Source

`class MonadFRP :: (Type -> Type) -> Constraint`

`class (MonadEffect m, MonadCleanup m) <= MonadFRP m`

A "type class alias" for the constraints required by most FRP primitives.

#### Instances

`(MonadEffect m, MonadCleanup m) => MonadFRP m`

### #subscribeEvent_ Source

`subscribeEvent_ :: forall m a. MonadEffect m => MonadCleanup m => (a -> Effect Unit) -> Event a -> m Unit`

### #subscribeDyn Source

`subscribeDyn :: forall m a b. MonadFRP m => (a -> Effect b) -> Dynamic a -> m (Dynamic b)`

### #readDynamic Source

`readDynamic :: forall m a. MonadEffect m => Dynamic a -> m a`

### #readBehavior Source

`readBehavior :: forall a. Behavior a -> Effect a`

Read a value of a Behavior.

### #pull Source

`pull :: forall a m. MonadEffect m => Effect a -> m a`

### #newEvent Source

`newEvent :: forall m a. MonadEffect m => m { event :: Event a, fire :: a -> Effect Unit }`

Create an Event that can be triggered externally.
Each `fire`

will run a frame where the event occurs.

### #newDynamic Source

`newDynamic :: forall m a. MonadEffect m => a -> m { dynamic :: Dynamic a, modify :: (a -> a) -> Effect Unit, read :: Effect a, set :: a -> Effect Unit }`

effectCrash :: forall a. String -> a
effectCrash msg = unsafeCoerce (_ -> unsafeCrashWith msg)
Construct a new root Dynamic that can be changed from `Effect`

-land.

### #newBehavior Source

`newBehavior :: forall m a. MonadEffect m => a -> m { behavior :: Behavior a, set :: a -> Effect Unit }`

Create a new Behavior whose value can be modified outside a frame.

### #latestJust Source

`latestJust :: forall m a. MonadFRP m => Dynamic (Maybe a) -> m (Dynamic (Maybe a))`

Returns a Dynamic that holds the latest `Just`

value of the input Dynamic
after execution of this function. If the input currently has value `Nothing`

, the resulting
Dynamic will have the value `Nothing`

until the input changes to a `Just`

.

The resulting Dynamic changes when the input changes to a value that is a `Just`

,
and doesn't change when the input changes to `Nothing`

.

### #holdUniqDynBy Source

`holdUniqDynBy :: forall m a. MonadFRP m => (a -> a -> Boolean) -> a -> Event a -> m (Dynamic a)`

### #foldDynMaybe Source

`foldDynMaybe :: forall m a b. MonadFRP m => (a -> b -> Maybe b) -> b -> Event a -> m (Dynamic b)`

Like `foldDyn`

, but the Dynamic will not update if the folding function
returns Nothing.

### #foldDyn Source

`foldDyn :: forall m a b. MonadFRP m => (a -> b -> b) -> b -> Event a -> m (Dynamic b)`

`foldDyn f x e`

- Make a Dynamic that will have the initial value `x`

,
and every time `e`

fires, its value will update by applying `f`

to the
event occurence value and the old value.

On cleanup, the Dynamic will stop updating in response to the event.

### #attachDynWith Source

`attachDynWith :: forall a b c. (a -> b -> c) -> Dynamic a -> Event b -> Event c`

### #_subscribeEvent Source

`_subscribeEvent :: forall a. EffectFn2 (a -> Effect Unit) (Event a) Unsubscribe`

## Re-exports from **Specular.**FRP.Fix

### #FixFRPRecord Source

`class FixFRPRecord :: RowList Type -> Row Type -> Row Type -> Constraint`

`class FixFRPRecord (ro_list :: RowList Type) (ri :: Row Type) (ro :: Row Type) | ro_list -> ri ro where`

#### Members

`fixRecord :: forall m b. MonadFRP m => Proxy ro_list -> (Record ri -> m (Tuple (Record ro) b)) -> m b`

#### Instances

`(TypeEquals (Record ()) (Record empty)) => FixFRPRecord Nil empty empty`

`(IsSymbol label, Lacks label tail_ri, Cons label input tail_ri ri, Lacks label tail_ro, Cons label output tail_ro ro, FixFRP input output, FixFRPRecord tail_ro_list tail_ri tail_ro) => FixFRPRecord (Cons label output tail_ro_list) ri ro`

### #fixDyn Source

`fixDyn :: forall m a b. MonadFRP m => (WeakDynamic a -> m (Tuple (Dynamic a) b)) -> m b`

## Re-exports from **Specular.**FRP.Replaceable

### #withDynamic_ Source

`withDynamic_ :: forall m a. MonadReplace m => MonadFRP m => Dynamic a -> (a -> m Unit) -> m Unit`

### #weakDynamic_ Source

`weakDynamic_ :: forall m. MonadReplace m => MonadFRP m => WeakDynamic (m Unit) -> m Unit`

### #weakDynamic Source

`weakDynamic :: forall m a. MonadReplace m => MonadFRP m => WeakDynamic (m a) -> m (WeakDynamic a)`

### #dynamic Source

`dynamic :: forall m a. MonadReplace m => MonadFRP m => Dynamic (m a) -> m (Dynamic a)`

## Re-exports from **Specular.**FRP.WeakDynamic

### #WeakDynamic Source

`newtype WeakDynamic a`_{}

A primitive similar to Dynamic. The difference is: while Dynamic always has a value, WeakDynamic has a value always after some point, but for some time after construction it may be without value.

A Dynamic can be always converted to a WeakDynamic using `weaken`

.

#### Instances

### #weaken Source

`weaken :: forall a. Dynamic a -> WeakDynamic a`

Convert a Dynamic to a WeakDynamic. It will have the same value as the original Dynamic, and will change whenever the original Dynamic changes.

### #uniqWeakDynBy Source

`uniqWeakDynBy :: forall m a. MonadFRP m => (a -> a -> Boolean) -> WeakDynamic a -> m (WeakDynamic a)`

Make a WeakDynamic that only changes value when the input WeakDynamic changes value, and the new value is not equal to the previous value with respect to the given equality test.

### #unWeakDynamic Source

`unWeakDynamic :: forall a. WeakDynamic a -> Dynamic (Maybe a)`

### #tagWeakDyn Source

`tagWeakDyn :: forall a. WeakDynamic a -> Event Unit -> Event a`

### #switchWeakDyn Source

`switchWeakDyn :: forall a. WeakDynamic (Event a) -> Event a`

Make an Event that occurs when the given WeakDynamic has a value, and the value (an Event) occurs.

### #subscribeWeakDyn_ Source

`subscribeWeakDyn_ :: forall m a. MonadFRP m => (a -> Effect Unit) -> WeakDynamic a -> m Unit`

Invoke the handler immediately if the WeakDynamic has a value currently, and invoke it every time it changes, until cleanup.

### #subscribeWeakDyn Source

`subscribeWeakDyn :: forall m a b. MonadFRP m => (a -> Effect b) -> WeakDynamic a -> m (WeakDynamic b)`

Invoke the handler immediately if the WeakDynamic has a value currently, and invoke it every time it changes, until cleanup.

### #holdWeakDyn Source

`holdWeakDyn :: forall m a. MonadFRP m => Event a -> m (WeakDynamic a)`

Make a WeakDynamic that will have no value, but will acquire one when the Event fires. It will also change every time the Event fires.

### #changedW Source

`changedW :: forall a. WeakDynamic a -> Event a`

An Event that fires every time a WeakDynamic changes, with the new value.

### #attachWeakDynWith Source

`attachWeakDynWith :: forall a b c. (a -> b -> c) -> WeakDynamic a -> Event b -> Event c`

- Modules
- Control.
Monad. Cleanup - Control.
Monad. Replace - Specular.
Debug - Specular.
Dom. Browser - Specular.
Dom. Builder - Specular.
Dom. Builder. Class - Specular.
Dom. Element - Specular.
Dom. Element. Class - Specular.
Dom. Node. Class - Specular.
Dom. Widget - Specular.
Dom. Widgets. Button - Specular.
Dom. Widgets. Input - Specular.
Dom. Widgets. RadioGroup - Specular.
Dom. Widgets. Select - Specular.
FRP - Specular.
FRP. Async - Specular.
FRP. Base - Specular.
FRP. Fix - Specular.
FRP. List - Specular.
FRP. Replaceable - Specular.
FRP. WeakDynamic - Specular.
Internal. Effect - Specular.
Internal. Incremental - Specular.
Internal. Incremental. Array - Specular.
Internal. Incremental. Effect - Specular.
Internal. Incremental. Global - Specular.
Internal. Incremental. Mutable - Specular.
Internal. Incremental. MutableArray - Specular.
Internal. Incremental. Node - Specular.
Internal. Incremental. Optional - Specular.
Internal. Incremental. PriorityQueue - Specular.
Internal. Incremental. Ref - Specular.
Internal. Profiling - Specular.
Internal. Queue - Specular.
Internal. RIO - Specular.
Profiling - Specular.
Ref

This instance allows use of the Boolean operators

`(||)`

and`(&&)`

directly on`Dynamic Bool`

.