Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

hackage.haskell.org : pinch-gen

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'. Package maintainers For package maintainers and hackage trustees Candidates pinch aims to provide an alternative implementation of Apache Thrift for Haskell. The pinch library itself acts only as a serialization library. Types specify their Thrift encoding by defining instances of the Pinchable typeclass, which may be done by hand or automatically with the use of Generics. Haddock documentation for this package is avilable on Hackage. Converts a Thrift file into Haskell code for the pinch library. Usage: The --hashable-vec-mod argument should be set to a module providing a Hashable instance for Vector. This is required as a Vector may become part of a key of a map, but neither the vector nor the hashable package provide an instance. For some background, see https://github.com/haskell/vector/pull/102 .The simplest solution is to depend on the vector-instances package and pass --hashable-vec-mod Data.Vector.Instances to pinch-gen. Let us use this simple Thrift service as an example: To generate the corresponding Haskell code we can call pinch-gen: This will create the appropriate datatypes for all struct, union and exception types: For the server, a record-style encoding of all functions is used. Given an implementation of these functions, a Pinch.Server.ThriftServer for use with the pinch library can be created: For the client, functions creating a Pinch.Client.ThriftCall for use with the pinch library are generated. You can use Pinch.Client.call if you want to explicitly match on the success result/thrown exceptions as defined in the Thrift file. Alternatively, you may use Pinch.Client.callOrThrow to directly access the result. In case the rqeuest failed, callOrThrow will throw an exception using throwIO. The generated code is currently not formatted very nicely.

Registry - Source - JSON
purl: pkg:hackage/pinch-gen
Keywords: bsd3, development, program
License: BSD-3-Clause
Latest release: 5 months ago
First release: over 3 years ago
Downloads: 538 total
Stars: 4 on GitHub
Forks: 3 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 15 days ago

    Loading...
    Readme
    Loading...