Created
February 3, 2020 21:46
-
-
Save dktn/af1221182b287ce03b91dade1c594bac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- specular | |
-- Specular.FRP.Base | |
nextTimeRef :: Ref Time | |
readBehavior :: forall a. Behavior a -> Pull a | |
newtype Event a = Event | |
{ occurence :: Behavior (Maybe a) | |
, subscribe :: Listener -> Effect Unsubscribe | |
} | |
newtype Dynamic a = Dynamic | |
{ value :: Behavior a | |
, change :: Event Unit | |
} | |
never :: forall a. Event a | |
filterMapEventB :: forall a b. (a -> Behavior (Maybe b)) -> Event a -> Event b | |
mapEventB :: forall a b. (a -> Behavior b) -> Event a -> Event b | |
gated :: forall a. Event a -> Event a | |
sampleAt :: forall a b. Event (a -> b) -> Behavior a -> Event b | |
filterMapEvent :: forall a b. (a -> Maybe b) -> Event a -> Event b | |
filterEvent :: forall a. (a -> Boolean) -> Event a -> Event a | |
filterJustEvent :: forall a. Event (Maybe a) -> Event a | |
mergeEvents :: forall a b c. (a -> Behavior c) -> (b -> Behavior c) -> (a -> b -> Behavior c) -> Event a -> Event b -> Event c | |
mergePulses :: Event Unit -> Event Unit -> Event Unit | |
subscribeEvent_ :: forall m a. MonadEffect m => MonadCleanup m => (a -> Effect Unit) -> Event a -> m Unit | |
_subscribeEvent :: forall a. EffectFn2 (a -> Effect Unit) (Event a) Unsubscribe | |
newEvent :: forall m a. MonadEffect m => m { event :: Event a, fire :: a -> Effect Unit } | |
newBehavior :: forall m a. MonadEffect m => a -> m { behavior :: Behavior a, set :: a -> Effect Unit } | |
newBehaviorEffect :: forall a. a -> Effect { behavior :: Behavior a, set :: a -> Effect Unit } | |
leftmost :: forall a. Array (Event a) -> Event a | |
findFirstM :: forall m a b. Monad m => (a -> m (Maybe b)) -> Array a -> m (Maybe b) | |
current :: forall a. Dynamic a -> Behavior a | |
changed :: forall a. Dynamic a -> Event a | |
changed_ :: forall a. Dynamic a -> Event Unit | |
foldDyn :: forall m a b. MonadFRP m => (a -> b -> b) -> b -> Event a -> m (Dynamic b) | |
newDynamic :: forall m a. MonadEffect m => a -> m { dynamic :: Dynamic a, read :: Effect a, set :: a -> Effect Unit, modify :: (a -> a) -> Effect Unit } | |
foldDynMaybe :: forall m a b. MonadFRP m => (a -> b -> Maybe b) -> b -> Event a -> m (Dynamic b) | |
holdDyn :: forall m a. MonadFRP m => a -> Event a -> m (Dynamic a) | |
holdUniqDynBy :: forall m a. MonadFRP m => (a -> a -> Boolean) -> a -> Event a -> m (Dynamic a) | |
uniqDynBy :: forall m a. MonadFRP m => (a -> a -> Boolean) -> Dynamic a -> m (Dynamic a) | |
uniqDyn :: forall m a. MonadFRP m => Eq a => Dynamic a -> m (Dynamic a) | |
switch :: forall a. Dynamic (Event a) -> Event a | |
joinDyn :: forall a. Dynamic (Dynamic a) -> Dynamic a | |
subscribeDyn_ :: forall m a. MonadFRP m => (a -> Effect Unit) -> Dynamic a -> m Unit | |
subscribeDyn :: forall m a b. MonadFRP m => (a -> Effect b) -> Dynamic a -> m (Dynamic b) | |
tagDyn :: forall a. Dynamic a -> Event Unit -> Event a | |
attachDynWith :: forall a b c. (a -> b -> c) -> Dynamic a -> Event b -> Event c | |
latestJust :: forall m a. MonadFRP m => Dynamic (Maybe a) -> m (Dynamic (Maybe a)) | |
readDynamic :: forall m a. MonadEffect m => Dynamic a -> m a | |
traceEventIO :: forall a. (a -> Effect Unit) -> Event a -> Event a | |
traceDynIO :: forall a. (a -> Effect Unit) -> Dynamic a -> Dynamic a | |
-- Specular.Ref | |
data Ref a = Ref (Dynamic a) (Callback (a -> a)) | |
newRef :: forall m a. MonadEffect m => a -> m (Ref a) | |
new :: forall m a. MonadEffect m => a -> m (Ref a) | |
newRefWithEvent :: forall m a. MonadFRP m => a -> Event (a -> a) -> m (Ref a) | |
refValue :: forall a. Ref a -> Dynamic a | |
value :: forall a. Ref a -> Dynamic a | |
refUpdate :: forall a. Ref a -> Callback (a -> a) | |
modify :: forall a. Ref a -> Callback (a -> a) | |
refUpdateConst :: forall a. Ref a -> Callback a | |
set :: forall a. Ref a -> Callback a | |
type Lens s a = { get :: s -> a, set :: s -> a -> s } | |
type Prism s a = { preview :: s -> Maybe a, review :: a -> s } | |
focusRef :: forall s a. Dynamic (Lens s a) -> Ref s -> Ref a | |
pureFocusRef :: forall s a. Lens s a -> Ref s -> Ref a | |
previewRef :: forall s a. Prism s a -> Ref s -> Ref (Maybe a) | |
updateRef :: forall a. Ref a -> a -> Effect Unit | |
readRef :: forall m a. MonadEffect m => Ref a -> m a | |
wrapViewWidget :: forall m a. MonadWidget m => (WeakDynamic a -> m (Event a)) -> Ref a -> m Unit | |
constRef :: forall a. a -> Ref a | |
-- Specular.FRP.Replaceable | |
dynamic_ :: forall m. MonadReplace m => MonadFRP m => Dynamic (m Unit) -> m Unit | |
withDynamic_ :: forall m a. MonadReplace m => MonadFRP m => Dynamic a -> (a -> m Unit) -> m Unit | |
dynamic :: forall m a. MonadReplace m => MonadFRP m => Dynamic (m a) -> m (Dynamic a) | |
weakDynamic_ :: forall m. MonadReplace m => MonadFRP m => WeakDynamic (m Unit) -> m Unit | |
weakDynamic :: forall m a. MonadReplace m => MonadFRP m => WeakDynamic (m a) -> m (WeakDynamic a) | |
whenJustD :: forall m a. MonadReplace m => MonadFRP m => Dynamic (Maybe a) -> (Dynamic a -> m Unit) -> m Unit | |
whenD :: forall m. MonadFRP m => MonadReplace m => Dynamic Boolean -> m Unit -> m Unit | |
unlessD :: forall m. MonadFRP m => MonadReplace m => Dynamic Boolean -> m Unit -> m Unit | |
-- Specular.Callback | |
newtype Callback a = Callback (a -> Effect Unit) | |
instance contravariantCallback :: Contravariant Callback | |
contramapCallbackDyn :: forall a b. Dynamic (b -> a) -> Callback a -> Callback b | |
contramapCallbackDyn_ :: forall a b. Dynamic a -> Callback a -> Callback b | |
contramapCallbackDynMaybe :: forall a b. Dynamic (b -> Maybe a) -> Callback a -> Callback b | |
contramapCallbackEffect :: forall a b. (b -> Effect a) -> Callback a -> Callback b | |
mkCallback :: forall a. (a -> Effect Unit) -> Callback a | |
newCallback :: forall m a. MonadEffect m => m { event :: Event a, callback :: Callback a } | |
triggerCallback :: forall a. Callback a -> a -> Effect Unit | |
attachEvent :: forall m a. MonadFRP m => Event a -> Callback a -> m Unit | |
attachDyn :: forall m a. MonadFRP m => Dynamic a -> Callback a -> m Unit | |
attachDomEvent :: forall m. MonadFRP m => EventType -> Node -> Callback SpecularDom.Event -> m Unit | |
nullCallback :: forall a. Callback a | |
dynCallback :: forall a. Dynamic (Callback a) -> Callback a | |
mbCallback :: forall a. Callback a -> Callback (Maybe a) | |
-- Specular.FRP.Fix | |
fixEvent :: forall m a b. MonadFRP m => (Event a -> m (Tuple (Event a) b)) -> m b | |
fixDyn :: forall m a b. MonadFRP m => (WeakDynamic a -> m (Tuple (Dynamic a) b)) -> m b | |
fixFRP_ :: forall input output m. FixFRP input output => MonadFRP m => (input -> m output) -> m Unit | |
fixFRP :: forall m b. MonadFRP m => (input -> m (Tuple output b)) -> m b | |
-- Specular.FRP.List | |
dynamicListWithIndex :: forall m a b. MonadFRP m => MonadReplace m => Dynamic (Array a) -> (Int -> Dynamic a -> m b) -> m (Dynamic (Array b)) | |
weakDynamicListWithIndex :: forall m a b. MonadFRP m => MonadReplace m => WeakDynamic (Array a) -> (Int -> WeakDynamic a -> m b) -> m (WeakDynamic (Array b)) | |
type ListEntry m a b = | |
{ slot :: Slot m | |
, fire :: a -> Effect Unit | |
, result :: b } | |
updateList :: forall m a b. MonadFRP m => Ref (Array (ListEntry m a b)) -> Slot m -> (Int -> Dynamic a -> m b) -> Array a -> Effect (Array b) | |
dynamicList :: forall m a b. MonadFRP m => MonadReplace m => Dynamic (Array a) -> (Dynamic a -> m b) -> m (Dynamic (Array b)) | |
weakDynamicList :: forall m a b. MonadFRP m => MonadReplace m => WeakDynamic (Array a) -> (WeakDynamic a -> m b) -> m (WeakDynamic (Array b)) | |
weakDynamicListWithIndex_ :: forall m a. MonadFRP m => MonadReplace m => WeakDynamic (Array a) -> (Int -> WeakDynamic a -> m Unit) -> m Unit | |
weakDynamicList_ :: forall m a. MonadFRP m => MonadReplace m => WeakDynamic (Array a) -> (WeakDynamic a -> m Unit) -> m Unit | |
dynamicListWithIndex_ :: forall m a. MonadFRP m => MonadReplace m => Dynamic (Array a) -> (Int -> Dynamic a -> m Unit) -> m Unit | |
dynamicList_ :: forall m a. MonadFRP m => MonadReplace m => Dynamic (Array a) -> (Dynamic a -> m Unit) -> m Unit | |
-- Specular.FRP.Async | |
startAff :: forall m. MonadFRP m => Aff Unit -> m Unit | |
data RequestState a = NotRequested | Loading | Loaded a | |
fromLoaded :: forall a. RequestState a -> Maybe a | |
asyncRequestMaybe :: forall m a. MonadEffect m => MonadFRP m => Dynamic (Maybe (Aff a)) -> m (Dynamic (RequestState a)) | |
asyncRequest :: forall m a. MonadEffect m => MonadFRP m => Dynamic (Aff a) -> m (Dynamic (RequestState a)) | |
performEvent :: forall m a. MonadFRP m => Event (Aff a) -> m (Event a) | |
-- Specular.FRP.WeakDynamic | |
newtype WeakDynamic a = WeakDynamic (MaybeT Dynamic a) | |
unWeakDynamic :: forall a. WeakDynamic a -> Dynamic (Maybe a) | |
mkWeakDynamic :: forall a. Dynamic (Maybe a) -> WeakDynamic a | |
weaken :: forall a. Dynamic a -> WeakDynamic a | |
changedW :: forall a. WeakDynamic a -> Event a | |
holdWeakDyn :: forall m a. MonadFRP m => Event a -> m (WeakDynamic a) | |
switchWeakDyn :: forall a. WeakDynamic (Event a) -> Event a | |
subscribeWeakDyn_ :: forall m a. MonadFRP m => (a -> Effect Unit) -> WeakDynamic a -> m Unit | |
subscribeWeakDyn :: forall m a b. MonadFRP m => (a -> Effect b) -> WeakDynamic a -> m (WeakDynamic b) | |
attachWeakDynWith :: forall a b c. (a -> b -> c) -> WeakDynamic a -> Event b -> Event c | |
tagWeakDyn :: forall a. WeakDynamic a -> Event Unit -> Event a | |
uniqWeakDynBy :: forall m a. MonadFRP m => (a -> a -> Boolean) -> WeakDynamic a -> m (WeakDynamic a) | |
-- Specular.Debug | |
traceEventWith :: forall a. DebugWarning => (a -> String) -> Event a -> Event a | |
traceEvent :: forall a. DebugWarning => Show a => String -> Event a -> Event a | |
traceDynWith :: forall a. DebugWarning => (a -> String) -> Dynamic a -> Dynamic a | |
traceDyn :: forall a. DebugWarning => Show a => String -> Dynamic a -> Dynamic a | |
-- libs/ps | |
-- Specular.FRP.Extra | |
forDyn_ :: forall f m a. MonadReplace m => MonadFRP m => Foldable f => Dynamic (f a) -> (a -> m Unit) -> m Unit | |
forWeakDyn_ :: forall f m a. MonadReplace m => MonadFRP m => Foldable f => WeakDynamic (f a) -> (a -> m Unit) -> m Unit | |
whenD :: forall m. MonadFRP m => MonadReplace m => Dynamic Boolean -> m Unit -> m Unit | |
unlessD :: forall m. MonadFRP m => MonadReplace m => Dynamic Boolean -> m Unit -> m Unit | |
chain :: forall m a b. MonadWidget m => m (Event a) -> (a -> m (Event b)) -> m (Event b) | |
uniqDyn :: forall m a. MonadFRP m => Eq a => Dynamic a -> m (Dynamic a) | |
sample :: forall m a. MonadFRP m => Effect a -> Event Unit -> m (Dynamic a) | |
-- Specular.FRP.Async.Extra | |
isLoading :: forall a. RequestState a -> Boolean | |
onLoaded :: forall m a b err. MonadWidget m => WeakDynamic (RequestState (Either err a)) -> Dynamic b -> (a -> m (Dynamic b)) -> m (Dynamic b) | |
onLoaded' :: forall m a b err. MonadWidget m => WeakDynamic (RequestState (Either err a)) -> b -> (a -> m b) -> m (Event b) | |
onLoadedE :: forall m a b err. MonadWidget m => WeakDynamic (RequestState (Either err a)) -> (a -> m (Event b)) -> m (Event b) | |
onLoadedAction :: forall m a err. MonadWidget m => WeakDynamic (RequestState (Either err a)) -> (a -> m Unit) -> m Unit | |
performEventUntilFirstSuccess :: forall a m. MonadFRP m => (a -> Boolean) -> Event (Aff a) -> m (Dynamic (RequestState a)) | |
fromLoadedSuccess :: forall e a. RequestState (Either e a) -> Maybe a | |
-- Specular.FormField | |
editRef :: forall a e. FormField a e -> Ref e | |
isTouched :: forall a e. FormField a e -> Dynamic Boolean | |
focusOutCallback :: forall a e. FormField a e -> Callback Unit | |
formFieldValue :: forall a e. FormField a e -> Dynamic e | |
finalValue :: forall a e. FormField a e -> Dynamic (V FieldErrors a) | |
finalValueNoErr :: forall a e. FormField a e -> Final a | |
liftDynamic :: forall a. Dynamic a -> Final a | |
-- Specular.ChoiceRef | |
choices :: forall a. ChoiceRef a -> Dynamic (Array a) | |
currentChoice :: forall a. ChoiceRef a -> Ref a | |
newChoiceRef :: forall m a. MonadEffect m => Eq a => Dynamic (Array a) -> a -> m (ChoiceRef a) | |
makeChoiceRef :: forall a. Eq a => Dynamic (Array a) -> Ref a -> ChoiceRef a | |
withSelectionStatus :: forall a. Eq a => ChoiceRef a -> Dynamic (Array { value :: a, selected :: Dynamic Boolean, select :: Callback Unit }) | |
-- Specular.MultiChoiceRef | |
choices :: forall a. MultiChoiceRef a -> Dynamic (Array a) | |
currentChoices :: forall a. MultiChoiceRef a -> Ref (Array a) | |
newMultiChoiceRef :: forall m a. MonadEffect m => Eq a => Dynamic (Array a) -> Array a -> m (MultiChoiceRef a) | |
makeMultiChoiceRef :: forall a. Eq a => Dynamic (Array a) -> Ref (Array a) -> MultiChoiceRef a | |
withSelectionStatus :: forall a. Eq a => MultiChoiceRef a -> Dynamic (Array { value :: a, selected :: Dynamic Boolean, select :: Callback Unit, deselect :: Callback Unit }) | |
toggleSelectionStatus :: forall e. { selected :: Dynamic Boolean, select :: Callback Unit, deselect :: Callback Unit | e } -> Ref Boolean | |
-- Specular.Extra | |
withLoadedSuccess :: forall m a. MonadWidget m => Aff (Either String a) -> (a -> m Unit) -> m Unit | |
waitUntil :: forall m a. MonadFRP m => Dynamic Boolean -> Event a -> m (Event a) | |
withPrevious :: forall m a. MonadFRP m => Dynamic a -> m (Dynamic { previous :: Maybe a, current :: a }) | |
-- Specular.Extra.LazyLoaded | |
mapRequestState :: forall a b. (a -> b) -> RequestState a -> RequestState b | |
newLazyLoaded :: forall m a. MonadFRP m => MonadReplace m => Aff a -> m (LazyLoaded a) | |
alreadyLoaded :: forall a. a -> LazyLoaded a | |
withLazyLoaded_ :: forall m a. MonadWidget m => LazyLoaded a -> m Unit | |
triggerRequest :: forall m a. MonadEffect m => LazyLoaded a -> m Unit | |
newImmediatelyLoaded :: forall m a. MonadFRP m => MonadReplace m => Aff a -> m (LazyLoaded a) | |
-- Specular.Extra.Paginate | |
paginate :: forall m a. MonadFRP m => (Int -> Aff (Array a)) -> m { content :: Dynamic (Array a), allLoaded :: Dynamic Boolean, getMore :: Callback Unit, isLoading :: Dynamic Boolean } | |
-- Specular.Ticker | |
init :: forall m. MonadFRP m => Timer -> Milliseconds -> m (Dynamic Instant) | |
-- Specular.Timer | |
clock :: forall m. MonadFRP m => Timer -> Milliseconds -> m (Event Unit) | |
clock' :: forall m. MonadFRP m => Timer -> Milliseconds -> m (Event TimerId) | |
fixTimeout :: Timer -> Milliseconds -> (TimerId -> Effect Unit) -> Effect TimerId | |
timeout :: forall a. Timer -> Milliseconds -> Aff a -> Aff (Maybe a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment