Shpadoinkle-backend-pardiff-0.2.0.0: A Virtual Dom in pure Haskell, based on Html as an Alignable Functor.

Safe HaskellNone
LanguageHaskell2010

Shpadoinkle.Backend.ParDiff

Description

This backend is to serve as a canonical representation of a well-behaved backend. Defining well-behaved in the context of web development is rather difficult and complex.

The rules of a backend are informal. Roughly, if we give the backend some Html, we expect it to update the DOM at runtime in the way we expect.

Since this is canonical, all other backends are expected to behave identically to this one. If differences exist they should be patched so that we retain renderer polymorphism, such that we can change out the renderer of our application; without updating the application logic with confidence it will behave as expected.

Synopsis

Documentation

newtype ParDiffT model m a Source #

Constructors

ParDiffT 

Fields

Instances
MonadBase n m => MonadBase n (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

liftBase :: n α -> ParDiffT model m α #

MonadBaseControl n m => MonadBaseControl n (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Associated Types

type StM (ParDiffT model m) a :: Type #

Methods

liftBaseWith :: (RunInBase (ParDiffT model m) n -> n a) -> ParDiffT model m a #

restoreM :: StM (ParDiffT model m) a -> ParDiffT model m a #

MonadTrans (ParDiffT model) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

lift :: Monad m => m a -> ParDiffT model m a #

MonadTransControl (ParDiffT model) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Associated Types

type StT (ParDiffT model) a :: Type #

Methods

liftWith :: Monad m => (Run (ParDiffT model) -> m a) -> ParDiffT model m a #

restoreT :: Monad m => m (StT (ParDiffT model) a) -> ParDiffT model m a #

(MonadUnliftIO m, MonadJSM m, Eq a, Show a) => Backend (ParDiffT a) m a Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Associated Types

type VNode (ParDiffT a) m :: Type

Methods

interpret :: (m ~> JSM) -> Html (ParDiffT a m) a -> ParDiffT a m (VNode (ParDiffT a) m)

patch :: RawNode -> Maybe (VNode (ParDiffT a) m) -> VNode (ParDiffT a) m -> ParDiffT a m (VNode (ParDiffT a) m)

setup :: JSM () -> JSM ()

Monad m => MonadReader (TVar model) (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

ask :: ParDiffT model m (TVar model) #

local :: (TVar model -> TVar model) -> ParDiffT model m a -> ParDiffT model m a #

reader :: (TVar model -> a) -> ParDiffT model m a #

Monad m => Monad (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

(>>=) :: ParDiffT model m a -> (a -> ParDiffT model m b) -> ParDiffT model m b #

(>>) :: ParDiffT model m a -> ParDiffT model m b -> ParDiffT model m b #

return :: a -> ParDiffT model m a #

fail :: String -> ParDiffT model m a #

Functor m => Functor (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

fmap :: (a -> b) -> ParDiffT model m a -> ParDiffT model m b #

(<$) :: a -> ParDiffT model m b -> ParDiffT model m a #

Applicative m => Applicative (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

pure :: a -> ParDiffT model m a #

(<*>) :: ParDiffT model m (a -> b) -> ParDiffT model m a -> ParDiffT model m b #

liftA2 :: (a -> b -> c) -> ParDiffT model m a -> ParDiffT model m b -> ParDiffT model m c #

(*>) :: ParDiffT model m a -> ParDiffT model m b -> ParDiffT model m b #

(<*) :: ParDiffT model m a -> ParDiffT model m b -> ParDiffT model m a #

Alternative m => Alternative (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

empty :: ParDiffT model m a #

(<|>) :: ParDiffT model m a -> ParDiffT model m a -> ParDiffT model m a #

some :: ParDiffT model m a -> ParDiffT model m [a] #

many :: ParDiffT model m a -> ParDiffT model m [a] #

MonadIO m => MonadIO (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

liftIO :: IO a -> ParDiffT model m a #

MonadJSM m => MonadJSM (ParDiffT model m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

liftJSM' :: JSM a -> ParDiffT model m a #

MonadUnliftIO m => MonadUnliftIO (ParDiffT r m) Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

Methods

askUnliftIO :: ParDiffT r m (UnliftIO (ParDiffT r m)) #

withRunInIO :: ((forall a. ParDiffT r m a -> IO a) -> IO b) -> ParDiffT r m b #

type StT (ParDiffT model) a Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

type StT (ParDiffT model) a = StT (ReaderT (TVar model)) a
type VNode (ParDiffT a) m Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

type VNode (ParDiffT a) m
type StM (ParDiffT model m) a Source # 
Instance details

Defined in Shpadoinkle.Backend.ParDiff

type StM (ParDiffT model m) a = ComposeSt (ParDiffT model) m a

runParDiff :: TVar model -> ParDiffT model m ~> m Source #

ParDiffT is a newtype of ReaderT, this is the runReaderT equivalent.

stage :: FromJSVal b => MonadJSM m => ParDiffT a m b Source #

Get the DOM node produced by setup.