refresht alternatives and similar packages
Based on the "Web" category.
Alternatively, view refresht alternatives based on common mentions on social networks and blogs.
-
yesod-persistent
A RESTful Haskell web framework built on WAI. -
haskell-bitmex-rest
swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition. -
swagger-petstore
swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition. -
scotty
Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp (Official Repository) -
servant
Main repository for the servant libraries — DSL for describing, serving, querying, mocking, documenting web applications and more! -
neuron
Future-proof note-taking and publishing based on Zettelkasten (superseded by Emanote: https://github.com/srid/emanote) -
haskell-kubernetes
Haskell bindings to the Kubernetes API (via swagger-codegen) -
airship
Helium + Webmachine = Airship. A toolkit for building declarative, RESTful web apps. -
apecs-gloss
a fast, extensible, type driven Haskell ECS framework for games -
digestive-functors
A general way to consume input using applicative functors -
tagsoup
Haskell library for parsing and extracting information from (possibly malformed) HTML/XML documents -
hbro
[Unmaintained] A minimal web-browser written and configured in Haskell. -
servant-elm
Automatically derive Elm functions to query servant webservices -
backprop
Heterogeneous automatic differentiation ("backpropagation") in Haskell -
kubernetes-client-core
Haskell client for the kubernetes API. A work in progress. -
keera-hails-reactive-htmldom
Keera Hails: Haskell on Rails - Reactive Programming Framework for Interactive Haskell applications -
engine-io
A Haskell server implementation of the Engine.IO and Socket.IO (1.0) protocols -
ghcjs-dom
Make Document Object Model (DOM) apps that run in any browser and natively using WebKitGtk -
ghcjs-base
base library for GHCJS for JavaScript interaction and marshalling, used by higher level libraries like JSC
Access the most powerful time series database as a service
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of refresht or a related project?
README
RefreshT -- Environment Monad with automatic resource refreshment
Overview
refresht
package provides similar interface as ReaderT
-monad,
but it comes with automatic refreshment mechanism.
In other words, the RefreshT
monad transformer provides the
general way to maintain the freshness of the external environment,
with respoec to the specified condition or exceptions.
The typical usage is to communicate with the server which requires periodic refreshment of access tokens, such as Google API.
Usage
The following pseudo-code illustrates the typical usage:
import Control.Monad.Refresh
import Network.Wreq (getWith, defaults)
import Control.Lens ((&), (.~), (^.))
import Data.Time (addUTCTime, getCurrentTime, UTCTime)
import Data.ByetString.Lazy.Char8 (unpack)
import Control.Exception (fromException)
data User = User { expiration :: UTCTime
, accessToken :: String
}
main :: IO ()
main = do
time <- getCurrentTime
evalRefreshT conf (User (3600 `addUTCTime` time) "initialtoken") $ do
rsc <- withEnv $ \User{..} ->
getWith (defaults & auth .~ oauth2Bearer accessToken)
"https://example.com/api/resource"
putStrLn $ print rsc
conf :: RefreshSetting User IO
conf = defaultRefreshSetting
& refresher .~ update
& shouldRefresh .~ checkExpr
& isRefreshingError .~ isRefreshing
where
shouldRefresh usr = do -- checks expiration
now <- getCurrentTime
return $ now <= expiration usr
update usr = do
-- Refreshed token for the service
bdy <- getWith
(defaults & param "token" .~ [accessToken usr])
"https://example.com/api/refresh_token"
let token = unpack $ bdy ^. responseBody
usr' = usr { accessToken = token
, expiration = ...
}
-- Save updates in local file, or db.
writeFile "database" (show usr')
return usr'
-- 401 Unauthorized exception should cause refreshment
isRefreshing e =
case fromException e of
Just Error401 -> True
_ -> False