lightning-haskell-0.1.0.3: Haskell client for lightning-viz REST API

Copyright(c) Connor Moreside, 2016
LicenseBSD-3
Maintainerconnor@moresi.de
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Web.Lightning.Types.Lightning

Contents

Description

 

Synopsis

Lightning Types

type Lightning a = LightningT IO a Source

Represents an IO Lightning transformer action.

data LightningF m a where Source

Defines the available actions

Constructors

FailWith :: APIError LightningError -> LightningF m a 
ReceiveRoute :: Receivable b => Route -> (b -> a) -> LightningF m a 
RunRoute :: FromJSON b => Route -> (b -> a) -> LightningF m a 
SendJSON :: Receivable b => Value -> Route -> (b -> a) -> LightningF m a 
WithBaseURL :: Text -> LightningT m b -> (b -> a) -> LightningF m a 

Instances

newtype LightningT m a Source

Defines free monad transformer

Constructors

LightningT (ReaderT BaseUrl (FreeT (LightningF m) m) a) 

Lightning Actions

runRoute Source

Arguments

:: (FromJSON a, Monad m) 
=> Route

Route to run

-> LightningT m a

Monad transformer stack with result.

Runs a route action within the free monadic transformer context.

sendPlot Source

Arguments

:: (ToJSON p, ValidatablePlot p, Receivable a, Monad m) 
=> Text

The plot type

-> p

The plot creation request

-> Route

The plot route.

-> LightningT m a

Monad transformer stack with result.

Sends a request to the lightning-viz server to create a visualization.

streamPlot Source

Arguments

:: (ToJSON p, ValidatablePlot p, Receivable a, Monad m) 
=> Maybe Visualization

Visualization to update. If nothing, create a new plot.

-> Text

Plot type

-> p

Plot payload

-> Route

Route to send plot to.

-> LightningT m a

Monad transformer stack with result.

Sends a request to either create a brand new streaming plot or to append data to an existing streaming plot.

sendJSON Source

Arguments

:: (Receivable a, Monad m) 
=> Value

The JSON payload

-> Route

Route to send request to

-> LightningT m a

Monad transformer stack with result.

Sends a request containing JSON to the specified route.

receiveRoute Source

Arguments

:: (Receivable a, Monad m) 
=> Route

The route to retrieve data from.

-> LightningT m a

Monad transformer stack with result.

Send and receives a GET request to the specified route.

withBaseURL Source

Arguments

:: Monad m 
=> Text

The new base URL.

-> LightningT m a

Next action to run.

-> LightningT m a

Monad transformer stack with result.

Replaces the base URL in the stack and run the supplied action afterwards.

failWith Source

Arguments

:: Monad m 
=> APIError LightningError

The error message to return.

-> LightningT m a

Monad transformer stack with error.

Returns an error message.

liftLightningF :: Monad m => FreeT (LightningF m) m a -> ReaderT Text (FreeT (LightningF m) m) a Source

Lifts a LightningF free monad into the ReaderT context.