https://github.com/tfausak/lackey
:gem: A Haskell library for generating Ruby consumers of Servant APIs.
https://github.com/tfausak/lackey
haskell ruby servant
Last synced: 9 months ago
JSON representation
:gem: A Haskell library for generating Ruby consumers of Servant APIs.
- Host: GitHub
- URL: https://github.com/tfausak/lackey
- Owner: tfausak
- License: mit
- Created: 2015-08-26T03:46:14.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2025-02-02T01:59:48.000Z (about 1 year ago)
- Last Synced: 2025-04-12T11:43:37.158Z (10 months ago)
- Topics: haskell, ruby, servant
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/lackey
- Size: 164 KB
- Stars: 23
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# [Lackey][]
[](https://github.com/tfausak/lackey/actions/workflows/ci.yml)
[](https://hackage.haskell.org/package/lackey)
Lackey is a Haskell library for generating Ruby consumers of [Servant][] APIs.
Use `Lackey.rubyForAPI` to generate a string of Ruby source code for consuming
a Servant API. For example:
``` hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
import qualified Data.Proxy as Proxy
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import qualified Lackey
import Servant.API
type API = "words" :> Get '[JSON] [String]
api :: Proxy.Proxy API
api = Proxy.Proxy
ruby :: Text.Text
ruby = Lackey.rubyForAPI api
main :: IO ()
main = Text.putStrLn ruby
-- def get_words(excon)excon.request(:method=>:get,:path=>"/words",:headers=>{},:body=>nil)end
```
The generated functions require [Excon][].
[Lackey]: https://github.com/tfausak/lackey
[Servant]: https://haskell-servant.readthedocs.org/en/stable/
[Excon]: https://rubygems.org/gems/excon