Skip to content

Instantly share code, notes, and snippets.

@dktn
Last active March 26, 2020 19:53
Show Gist options
  • Save dktn/80b9ea199ab5357020b85de85b57abd7 to your computer and use it in GitHub Desktop.
Save dktn/80b9ea199ab5357020b85de85b57abd7 to your computer and use it in GitHub Desktop.
-- -------------------------- specular --------------------------
-- Specular.FRP.Base
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
subscribeEvent_ :: forall m a. MonadEffect m => MonadCleanup m => (a -> Effect Unit) -> Event a -> m Unit
never :: forall a. Event a
newEvent :: forall m a. MonadEffect m => m { event :: Event a, fire :: a -> Effect Unit }
leftmost :: forall a. Array (Event a) -> Event a
current :: forall a. Dynamic a -> Behavior a
changed :: forall a. Dynamic a -> Event a
foldDyn :: forall m a b. MonadFRP m => (a -> b -> b) -> b -> Event a -> m (Dynamic b)
holdDyn :: forall m a. MonadFRP m => 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)
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
readDynamic :: forall m a. MonadEffect m => Dynamic a -> m a
-- Specular.Ref
data Ref a = Ref (Dynamic a) (Callback (a -> a))
type Lens s a = { get :: s -> a, set :: s -> a -> s }
new :: forall m a. MonadEffect m => a -> m (Ref a)
value :: forall a. Ref a -> Dynamic a
modify :: forall a. Ref a -> Callback (a -> a)
set :: forall a. Ref a -> Callback a
newRef :: forall m a. MonadEffect m => a -> m (Ref a)
refValue :: forall a. Ref a -> Dynamic a
refUpdate :: forall a. Ref a -> Callback (a -> a)
refUpdateConst :: forall a. Ref a -> Callback a
newRefWithEvent :: forall m a. MonadFRP m => a -> Event (a -> a) -> m (Ref a)
focusRef :: forall s a. Dynamic (Lens s a) -> Ref s -> Ref a
pureFocusRef :: forall s a. Lens s a -> Ref s -> Ref 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)
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
(>$<) :: forall a b. (b -> a) -> Callback a -> Callback b
(>$) :: forall a b. a -> Callback a -> Callback b
($<) :: forall a b. Callback a -> a -> Callback b
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
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.Async
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.List
-- Specular.Debug
-- -------------------------- libs/ps --------------------------
-- Specular.FRP.Extra
sample :: forall m a. MonadFRP m => Effect a -> Event Unit -> m (Dynamic a)
-- Specular.FRP.Async.Extra
isLoading :: forall a. RequestState a -> Boolean
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
-- Specular.Extra.LazyLoaded
-- Specular.Extra.Paginate
-- Specular.Ticker
init :: forall m. MonadFRP m => Timer -> Milliseconds -> m (Dynamic Instant)
-- Specular.Timer
clock :: forall m. MonadFRP m => Timer -> Milliseconds -> m (Event Unit)
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