Safe Haskell | None |
---|---|
Language | Haskell98 |
- data State = State {
- cs :: ClientState
- ls :: LoginState
- as :: APIState
- go :: GenericOptions
- initialState :: MonadIO m => GenericOptions -> m State
- type Guts x m r a = ReaderT (r -> x r r) (ContT r m) a
- newtype VK r a = VK {}
- stepVK :: VK r r -> StateT State (ExceptT Text IO) r
- defaultSuperviser :: Show a => VK (R VK a) (R VK a) -> StateT State (ExceptT Text IO) a
- runLogin :: GenericOptions -> ExceptT Text IO AccessToken
- runAPI :: Show b => GenericOptions -> VK (R VK b) b -> ExceptT Text IO b
- runVK :: Show a => GenericOptions -> VK (R VK a) a -> IO (Either Text a)
- runVK_ :: Show a => GenericOptions -> VK (R VK a) a -> IO ()
- module Web.VKHS.Client
- module Web.VKHS.Types
- module Web.VKHS.Error
- module Web.VKHS.Monad
- module Web.VKHS.Login
- module Web.VKHS.API
Documentation
Main state of the VK monad stack. Consists of lesser states plus a copy of generic options provided by the caller.
State | |
|
initialState :: MonadIO m => GenericOptions -> m State Source #
Main VK monad able to track errors, track full state State
, set
early exit by the means of continuation monad. VK encodes a coroutine which
has entry points defined by Result
datatype.
See also runVK
and defaultSuperwiser
.
- FIXME Re-write using modern
Free
MonadAPI VK r State Source # | |
MonadState State (VK r) Source # | |
Monad (VK r) Source # | |
Functor (VK r) Source # | |
Applicative (VK r) Source # | |
MonadIO (VK r) Source # | |
MonadCont (VK r) Source # | |
MonadClient (VK r) State Source # | |
MonadVK (VK r) r Source # | |
MonadLogin (VK r) r State Source # | |
MonadReader (r -> VK r r) (VK r) Source # | |
stepVK :: VK r r -> StateT State (ExceptT Text IO) r Source #
Run the VK coroutine till next return. Consider using runVK
for full
spinup.
defaultSuperviser :: Show a => VK (R VK a) (R VK a) -> StateT State (ExceptT Text IO) a Source #
Run VK monad m
and handle continuation requests using default
algorithm. defaultSuperwiser
would relogin on invalid access token
condition, ask for missing form fields (typically - an email/password)
See also runVK
- FIXME Store known answers in external DB (in file?) instead of LoginState FIXME dictionary
- FIXME Handle capthas (offer running standalone apps)
runLogin :: GenericOptions -> ExceptT Text IO AccessToken Source #
Run login procedure using defaultSuperwiser
. Return AccessToken
on
success
runAPI :: Show b => GenericOptions -> VK (R VK b) b -> ExceptT Text IO b Source #
Run the VK monad m
using generic options go
and defaultSuperwiser
.
Perform login procedure if needed. This is an mid-layer runner, consider
using runVK
instead.
runVK :: Show a => GenericOptions -> VK (R VK a) a -> IO (Either Text a) Source #
Run the VK monad m
using generic options go
and defaultSuperwiser
runVK_ :: Show a => GenericOptions -> VK (R VK a) a -> IO () Source #
A version of runVK
with unit return.
module Web.VKHS.Client
module Web.VKHS.Types
module Web.VKHS.Error
module Web.VKHS.Monad
module Web.VKHS.Login
module Web.VKHS.API