Git Product home page Git Product logo

wayland-wire's Introduction

wayland-wire

Introduction

This package provides a way to generate both server and client Haskell-bindings from a wayland protocol definition in XML.

Generate bindings

Given an XML-protocol definition named test.xml

$(generateFromXml Client "test.xml")

can be used to generate the Haskell-bindings for the client side. The module with the generated code needs the following extensions to be enabled:

  • FlexibleContexts
  • MultiParamTypeClasses
  • Rank2Types
  • TemplateHaskell
  • TypeFamilies

Use the bindings

The bindings will create an empty data-type for every interface. The wl_display interface in the core wayland protocol would for instance get the following definition:

data WlDisplay

and it would be made an instance of Dispatchable and DispatchInterace. This makes it possible to send signals or add slots. On the server side the slots are the requests, and the signals are the events. On the client side it is the other way around, since signals are always defined as the outgoing messages, while slots handle the incoming messages. For example, to send a display error from the server to the client one could do:

wlDisplayError (signals display) objIdOfBadObject errorCode "An error occured"

The W Monad-transformer can be used to track objects and their slot handlers, or you could define your own by making it an instance of MonadObject. You also need a Monad that implements MonadSend for the generated bindings to be able to send messages.

wayland-wire's People

Contributors

cippo avatar sivertb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.