Module

Refract

Package
purescript-refract
Repository
pkamenarsky/purescript-refract

#(○) Source

Operator alias for Control.Semigroupoid.compose (right-associative / precedence 9)

A synonym for <<<.

#(×) Source

Operator alias for Data.Tuple.Tuple (right-associative / precedence 6)

A synonym for Tuple.

#type (×) Source

Operator alias for Data.Tuple.Tuple (right-associative / precedence 6)

A type synonym for Tuple.

#_id Source

_id :: forall a. Lens' a a

The identity Lens.

#EffectF Source

data EffectF eff st next

The base functor of the Effect free monad.

Instances

#Effect Source

type Effect eff st = Free (EffectF eff st)

An Effect with base type st.

#modify Source

modify :: forall st eff. (st -> st) -> Effect eff st Unit

Modify the current Component state.

#effectfully Source

effectfully :: forall st eff a. (st -> Aff eff a) -> Effect eff st a

Perform a Control.Monad.Aff action and return a result.

#state Source

state :: forall st eff. (st -> Component eff st) -> Component eff st

Reify the current Component state.

#stateL Source

stateL :: forall stt st eff. ALens' st stt -> (stt -> Component eff st) -> Component eff st

Reify Component substate specified by a lens.

#stateR Source

stateR :: forall st rs r eff. RecordToLens st r rs => Record r -> (Record rs -> Component eff st) -> Component eff st

stateL for generic records.

Specializing to a concrete state, its type would be:

stateR
  :: ∀ eff st.
     { name :: ALens' st String
     , age :: ALens' st Int
     }
  -> ( { name :: String
       , age :: Int
       } -> Component eff st
     )
  -> Component eff st

#modifyL Source

modifyL :: forall stt st eff. ALens' st stt -> (stt -> stt) -> Effect eff st Unit

Modify Component substate specified by a Lens.

#modifyR Source

modifyR :: forall st rs r eff. RecordToLens st r rs => Record r -> (Record rs -> Record rs) -> Effect eff st Unit

modifyL for generic records.

Specializing to a concrete state, its type would be:

modifyR
  :: ∀ eff st.
     { name :: ALens' st String
     , age :: ALens' st Int
     }
  -> ({ name :: String , age :: Int } -> { name :: String , age :: Int })
  -> Effect eff st Unit

#Unzoom Source

type Unzoom eff st stt = Component eff st -> Component eff stt

#zoom Source

zoom :: forall stt st eff. ALens' st stt -> Component eff stt -> Component eff st

Embed a Component with a state of type stt into a Component with a state of type st.

#zoomUn Source

zoomUn :: forall stt st eff. ALens' st stt -> (Unzoom eff st stt -> Component eff stt) -> Component eff st

Embed a Component with a state of type stt into a Component with a state of type st and provide it with an unzoom combinator.

#zoomR Source

zoomR :: forall st rs r eff. RecordToLens st r rs => Record r -> Component eff (Record rs) -> Component eff st

zoom for generic records.

Specializing to a concrete state, its type would be:

zoomR
  :: ∀ eff st.
     { name :: ALens' st String
     , age :: ALens' st Int
     }
  -> Component eff
       { name :: String
       , age :: Int
       }
  -> Component eff st

#zoomRUn Source

zoomRUn :: forall st rs r eff. RecordToLens st r rs => Record r -> (Unzoom eff st (Record rs) -> Component eff (Record rs)) -> Component eff st

zoomUn for generic records.

#Props Source

type Props eff st = (Effect eff st Unit -> Handler st) -> Props

#Component Source

type Component eff st = (Effect eff st Unit -> Handler st) -> st -> ReactElement

A Component eff st is parameterized over an effect type eff and a state type st over which it operates.

#ComponentClass Source

type ComponentClass eff st = ReactClass ((Effect eff st Unit -> Handler st) × st)

A React component class. Useful whenever a Component needs to implement React lifecycle methods.

#Spec Source

type Spec eff st = { componentDidMount :: Effect eff st Unit, componentDidUpdate :: st -> Effect eff st Unit, componentWillMount :: Effect eff st Unit, componentWillUnmount :: Effect eff st Unit, componentWillUpdate :: st -> Effect eff st Unit, displayName :: String, shouldComponentUpdate :: st -> Boolean }

React lifecycle spec.

#defaultSpec Source

defaultSpec :: forall st eff. Spec eff st

No-op lifecycle method spec.

#componentClass Source

componentClass :: forall st eff. Spec eff st -> Component eff st -> ComponentClass eff st

Create a ComponentClass from a Spec and a Component.

#component Source

component :: forall st eff. ComponentClass eff st -> Component eff st

Create a Component from a ComponentClass.

#mkComponent Source

mkComponent :: forall st eff. String -> Array (Props eff st) -> Array (Component eff st) -> Component eff st

Create a DOM element Component.

#run Source

run :: forall st eff. String -> Component eff st -> st -> (st -> Eff eff Unit) -> Eff (dom :: DOM | eff) Unit

Attach Component to the DOM element with the specified id and run it.

#foreach Source

foreach :: forall a st eff. ALens' st (Array a) -> (ALens' st a -> Component eff st) -> Component eff st

Unfiltered Array traversal.

#foreachF Source

foreachF :: forall a st eff. (a -> Boolean) -> ALens' st (Array a) -> (ALens' st a -> Component eff st) -> Component eff st

Filtered Array traversal.

#foreachU Source

foreachU :: forall a st eff. ALens' st (Array a) -> (Unzoom eff st a -> Component eff a) -> Component eff st

Unfiltered Array traversal providing an unzoom combinator.

#foreachUF Source

foreachUF :: forall a st eff. (a -> Boolean) -> ALens' st (Array a) -> (Unzoom eff st a -> Component eff a) -> Component eff st

Filtered Array traversal providing an unzoom combinator.

#foreachZ Source

foreachZ :: forall a st eff. ALens' st (Array a) -> Component eff a -> Component eff st

Zooming unfiltered Array traversal.

#foreachZF Source

foreachZF :: forall a st eff. (a -> Boolean) -> ALens' st (Array a) -> Component eff a -> Component eff st

Zooming filtered Array traversal.

#foreachMap Source

foreachMap :: forall v k st eff. Ord k => (k × v -> k × v -> Ordering) -> ALens' st (Map k v) -> (ALens' st v -> (st -> st) -> Component eff st) -> Component eff st

Unfiltered Map traversal.

#foreachMapF Source

foreachMapF :: forall v k st eff. Ord k => (k × v -> k × v -> Ordering) -> (k × v -> Boolean) -> ALens' st (Map k v) -> (ALens' st v -> (st -> st) -> Component eff st) -> Component eff st

Filtered Map traversal.

#foreachMapU Source

foreachMapU :: forall v k st eff. Ord k => (k × v -> k × v -> Ordering) -> ALens' st (Map k v) -> (Unzoom eff st v -> (st -> st) -> Component eff v) -> Component eff st

Unfiltered Map traversal providing an unzoom combinator.

#foreachMapUF Source

foreachMapUF :: forall v k st eff. Ord k => (k × v -> k × v -> Ordering) -> (k × v -> Boolean) -> ALens' st (Map k v) -> (Unzoom eff st v -> (st -> st) -> Component eff v) -> Component eff st

Filtered Map traversal providing an unzoom combinator.