lightning-haskell-0.1.0.2: 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

Functor (LightningF m) Source # 

Methods

fmap :: (a -> b) -> LightningF m a -> LightningF m b #

(<$) :: a -> LightningF m b -> LightningF m a #

newtype LightningT m a Source #

Defines free monad transformer

Constructors

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

Instances

MonadTrans LightningT Source # 

Methods

lift :: Monad m => m a -> LightningT m a #

Monad m => MonadReader Text (LightningT m) Source # 

Methods

ask :: LightningT m Text #

local :: (Text -> Text) -> LightningT m a -> LightningT m a #

reader :: (Text -> a) -> LightningT m a #

Monad m => Monad (LightningT m) Source # 

Methods

(>>=) :: LightningT m a -> (a -> LightningT m b) -> LightningT m b #

(>>) :: LightningT m a -> LightningT m b -> LightningT m b #

return :: a -> LightningT m a #

fail :: String -> LightningT m a #

Monad m => Functor (LightningT m) Source # 

Methods

fmap :: (a -> b) -> LightningT m a -> LightningT m b #

(<$) :: a -> LightningT m b -> LightningT m a #

Monad m => Applicative (LightningT m) Source # 

Methods

pure :: a -> LightningT m a #

(<*>) :: LightningT m (a -> b) -> LightningT m a -> LightningT m b #

(*>) :: LightningT m a -> LightningT m b -> LightningT m b #

(<*) :: LightningT m a -> LightningT m b -> LightningT m a #

MonadIO m => MonadIO (LightningT m) Source # 

Methods

liftIO :: IO a -> LightningT m a #

class ValidatablePlot a where Source #

Allows plot fields to be validated.

Minimal complete definition

validatePlot

Instances

ValidatablePlot VolumePlot Source # 
ValidatablePlot ScatterStreamPlot Source # 
ValidatablePlot Scatter3Plot Source # 
ValidatablePlot ScatterPlot Source # 
ValidatablePlot MatrixPlot Source # 
ValidatablePlot MapPlot Source # 
ValidatablePlot LineStreamPlot Source # 
ValidatablePlot LinePlot Source # 
ValidatablePlot HistogramPlot Source # 
ValidatablePlot GraphPlot Source # 
ValidatablePlot ForcePlot Source # 
ValidatablePlot CirclePlot Source # 
ValidatablePlot AdjacencyPlot Source # 

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.