Comments (3)
Hi, sounds good to me but to be honest, I'm not sure how to convert it to tagless final right away. If you have good example I can take a look at or draft a solution here it would help a lot.
Regarding breaking the API - I don't think there are that many users of this library so it should be fine.
from blockfrost-haskell.
I've remembered about https://jproyo.github.io/posts/2019-03-17-tagless-final-haskell.html and it makes sense, having a typeclass BlockfrostClient
(or maybe just Blockfrost
to avoid name clashes) with instance that can possibly call the fixed mtl
client functions. What I'm not sure about is ReaderT
containing Project
, maybe we can just wrap our old BlockfrostClient
type though. I'll play with it a bit!
from blockfrost-haskell.
Hi, I've opened #11 which adds MonadBlockfrost
class allowing you to use a custom monad instead of the default BlockfrostClient
.
Using this I was able to compose it with example TestapiM
like this:
class Monad m => TestapiM m where
mGetTest :: m Bool
sample :: (MonadBlockfrost m, TestapiM m) => m ()
sample = pure ()
type GlobalConfig = (Bool, ClientConfig)
type App = ReaderT GlobalConfig (ExceptT ClientError IO)
runApp :: ClientConfig -> App a -> IO (Either ClientError a)
runApp globalC = runExceptT . flip runReaderT (True, globalC)
instance TestapiM App where
mGetTest = fst <$> ask
instance MonadBlockfrost App where
liftBlockfrostClient act = getConf >>= \(env, _prj) ->
(liftIO $ runClientM act env)
getConf = snd <$> ask
Would this work for you?
from blockfrost-haskell.
Related Issues (13)
- "block_time" missing from the AddressTransaction type HOT 1
- Add missing class instances to the Slot type HOT 1
- DecodeFailure when calling `getAccount` HOT 2
- Specifying count HOT 4
- Decode failure from getEpochStakeByPool HOT 2
- Misleading documentation or type wrt number of returned results. HOT 1
- `allPages` returns pages in the reverse order. HOT 1
- Overlapping instances HOT 2
- Orphaned `Arbitrary` instances are brought into scope by the `Blockfrost.Client` HOT 2
- `AddressUtxo` misses address of UTxO which is useful when querying by `addr_vkh...` address
- blockfrost-client 0.8.0.0 doesn't build with GHC 9.6.3 HOT 1
- Switch TX evaluate to old ogmios reply
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blockfrost-haskell.