Module

Grain

Package
purescript-grain
Repository
purescript-grain/purescript-grain

Re-exports from Grain.Class

#NonKeyedGrain Source

class NonKeyedGrain :: (Type -> Type) -> Type -> Constraintclass (Grain p a) <= NonKeyedGrain p a 

Instances

Re-exports from Grain.Class.GProxy

#GProxy Source

data GProxy a

A type of global state proxy.

Constructors

#GlobalGrain Source

class GlobalGrain a 

Representation of a partial state of application state.

You can use this to define global state.

TypeRef is used as state key internally for uniqueness.

Re-exports from Grain.Class.KGProxy

#KGProxy Source

data KGProxy k a

A type of keyed global state proxy.

Constructors

#GrainKey Source

class GrainKey a 

Representation of key type for keyed global state.

This class's instances can be key for keyed global state.

Instances

#KeyedGlobalGrain Source

class (GrainKey k) <= KeyedGlobalGrain k a | a -> k

Representation of a partial state of application state.

You can use this to define global state with key for dynamic items.

The first parameter is a type of key for each item, and the second parameter is a type of item.

TypeRef is used as state key internally for uniqueness.

Re-exports from Grain.Class.LProxy

#LProxy Source

data LProxy a

A type of component-local state proxy.

Constructors

#LocalGrain Source

class LocalGrain a 

Representation of a component-local state.

TypeRef is used as state key internally for uniqueness.

Re-exports from Grain.TypeRef

#fromConstructor Source

fromConstructor :: forall a. a -> TypeRef

Create a TypeRef.

Treat a constructor function as reference of type.

Re-exports from Grain.UI

#VNode Source

data VNode

The type of virtual node.

#Render Source

newtype Render a

The type of component renderer.

In this monad, you can declare that you use some states and updaters.

Instances

#useValue Source

useValue :: forall p a. NonKeyedGrain p a => p a -> Render a

Listen a state, then return it.

If the state is changed, the component will be rerendered.

#useUpdater Source

useUpdater :: forall p a. NonKeyedGrain p a => p a -> Render ((a -> a) -> Effect Unit)

Get an updater of a state.

#usePortal Source

usePortal :: Effect Node -> Render (VNode -> VNode)

Get portal function.

#useKeyedValue Source

useKeyedValue :: forall k a. KeyedGlobalGrain k a => KGProxy k a -> k -> Render a

Listen a keyed global state, then return it.

If the state is changed, the component will be rerendered.

#useKeyedUpdater Source

useKeyedUpdater :: forall k a. KeyedGlobalGrain k a => KGProxy k a -> Render (k -> (a -> a) -> Effect Unit)

Get an updater of a keyed global state.

#useKeyedFinder Source

useKeyedFinder :: forall k a. KeyedGlobalGrain k a => KGProxy k a -> Render (k -> Effect a)

Get a finder of a keyed global state.

#useFinder Source

useFinder :: forall p a. NonKeyedGrain p a => p a -> Render (Effect a)

Get a finder of a state.

#mount Source

mount :: VNode -> Node -> Effect Unit

Mount a VNode to a parent node.