HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduledbus-1.4.1Haskell2010

DBus

Basic types, useful to every D-Bus application.

Authors of client applications should import DBus.Client, which provides an easy RPC-oriented interface to D-Bus methods and signals.

  • 22 types
  • 4 classes
  • 78 values
  • Packagedbus-1.4.1
  • Exports104
  • LanguageHaskell2010
  • LicenceApache-2.0
  • SourceDBus.hs

Messages

1 declaration

Method calls

datadata MethodCall
#

A method call is a request to run some procedure exported by the remote process. Procedures are identified by an (object_path, interface_name, method_name) tuple.

Instances3Eq, Show, Message

The object path of the method call. Conceptually, object paths act like a procedural language's pointers. Each object referenced by a path is a collection of procedures.

The interface of the method call. Each object may implement any number of interfaces. Each method is part of at least one interface.

In certain cases, this may be Nothing, but most users should set it to a value.

The name of the application that sent this call.

Most users will just leave this empty, because the bus overwrites the sender for security reasons. Setting the sender manually is used for peer-peer connections.

Defaults to Nothing.

The name of the application to send the call to.

Most users should set this. If a message with no destination is sent to the bus, the bus will behave as if the destination was set to org.freedesktop.DBus. For peer-peer connections, the destination can be empty because there is only one peer.

Defaults to Nothing.

Method returns

datadata MethodReturn
#

A method return is a reply to a method call, indicating that the call succeeded.

Instances3Eq, Show, Message

The name of the application that is returning from a call.

Most users will just leave this empty, because the bus overwrites the sender for security reasons. Setting the sender manually is used for peer-peer connections.

Defaults to Nothing.

The name of the application that initiated the call.

Most users should set this. If a message with no destination is sent to the bus, the bus will behave as if the destination was set to org.freedesktop.DBus. For peer-peer connections, the destination can be empty because there is only one peer.

Defaults to Nothing.

Method errors

datadata MethodError
#

A method error is a reply to a method call, indicating that the call received an error and did not succeed.

Instances3Eq, Show, Message

The name of the application that is returning from a call.

Most users will just leave this empty, because the bus overwrites the sender for security reasons. Setting the sender manually is used for peer-peer connections.

Defaults to Nothing.

The name of the application that initiated the call.

Most users should set this. If a message with no destination is sent to the bus, the bus will behave as if the destination was set to org.freedesktop.DBus. For peer-peer connections, the destination can be empty because there is only one peer.

Defaults to Nothing.

Additional information about the error. By convention, if the error body contains any items, the first item should be a string describing the error.

Signals

datadata Signal
#

Signals are broadcast by applications to notify other clients of some event.

Instances3Eq, Show, Message
  • Eq SignalDefined in dbus-1.4.1 · DBus.Internal.Message
  • Show SignalDefined in dbus-1.4.1 · DBus.Internal.Message
  • Message SignalDefined in dbus-1.4.1 · DBus.Internal.Message

The name of the application that emitted this signal.

Most users will just leave this empty, because the bus overwrites the sender for security reasons. Setting the sender manually is used for peer-peer connections.

Defaults to Nothing.

The name of the application to emit the signal to. If Nothing, the signal is sent to any application that has registered an appropriate match rule.

Defaults to Nothing.

valuesignalBody :: Signal -> [Variant]
#

Additional information about the signal, such as the new value or the time.

Defaults to [].

Received messages

datadata ReceivedMessage
#

Not an actual message type, but a wrapper around messages received from the bus. Each value contains the message's Serial.

If casing against these constructors, always include a default case to handle messages of an unknown type. New message types may be added to the D-Bus specification, and applications should handle them gracefully by either ignoring or logging them.

Instances2Eq, Show

Variants

7 declarations
newtypenewtype Variant
#

Variants may contain any other built-in D-Bus value. Besides representing native VARIANT values, they allow type-safe storage and inspection of D-Bus collections.

Instances4Eq, Show, IsValue, IsVariant
classclass IsVariant a where
#

Methods

Instances44IsVariant, …
valuevariantType :: Variant -> Type
#

Every variant is strongly-typed; that is, the type of its contained value is known at all times. This function retrieves that type, so that the correct cast can be used to retrieve the value.

classclass IsValue a => IsAtom a where
#

Atomic types can be used as keys to dictionaries.

Users may not provide new instances of IsAtom because this could allow dictionaries to be created with invalid keys.

Instances15IsAtom, …
classclass IsVariant a => IsValue a where
#

Value types can be used as items in containers, such as lists or dictionaries.

Users may not provide new instances of IsValue because this could allow containers to be created with items of heterogenous types.

Instances36IsValue, …
valuetypeOf :: IsValue a => a -> Type
#

Deprecated. Get the D-Bus type corresponding to the given Haskell value. The value may be undefined.

Signatures

7 declarations
newtypenewtype Signature
#

A signature is a list of D-Bus types, obeying some basic rules of validity.

The rules of signature validity are complex: see http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures for details.

Instances8Eq, Ord, Show, IsString, NFData, IsAtom, …
datadata Type
#
Instances6Eq, Ord, Show, Generic, NFData, Rep
valuesignature_ :: [Type] -> Signature
#

Convert a list of types into a valid signature.

Throws an exception if the given types are not a valid signature.

Object paths

4 declarations
newtypenewtype ObjectPath
#

Object paths are special strings, used to identify a particular object exported from a D-Bus application.

Object paths must begin with a slash, and consist of alphanumeric characters separated by slashes.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path for details.

Instances9Eq, Ord, Show, IsString, NFData, IsAtom, …

Names

0 declarations

Interface names

newtypenewtype InterfaceName
#

Interfaces are used to group a set of methods and signals within an exported object. Interface names consist of alphanumeric characters separated by periods.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface for details.

Instances7Eq, Ord, Show, IsString, NFData, IsVariant, …

Member names

newtypenewtype MemberName
#

Member names are used to identify a single method or signal within an interface. Method names consist of alphanumeric characters.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-member for details.

Instances7Eq, Ord, Show, IsString, NFData, IsVariant, …

Error names

newtypenewtype ErrorName
#

Error names are used to identify which type of error was returned from a method call. Error names consist of alphanumeric characters separated by periods.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-error for details.

Instances6Eq, Ord, Show, IsString, NFData, IsVariant

Bus names

newtypenewtype BusName
#

Bus names are used to identify particular clients on the message bus. A bus name may be either unique or well-known, where unique names start with a colon. Bus names consist of alphanumeric characters separated by periods.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus for details.

Instances7Eq, Ord, Show, IsString, NFData, IsVariant, …

Non-native containers

0 declarations

Structures

newtypenewtype Structure
#

A D-Bus Structure is a container type similar to Haskell tuples, storing values of any type that is convertable to IsVariant. A Structure may contain up to 255 values.

Most users can use the IsVariant instance for tuples to extract the values of a structure. This type is for very large structures, which may be awkward to work with as tuples.

Instances3Eq, Show, IsVariant

Arrays

datadata Array
#

A D-Bus Array is a container type similar to Haskell lists, storing zero or more values of a single D-Bus type.

Most users can use the IsVariant instance for lists or vectors to extract the values of an array. This type is for advanced use cases, where the user wants to convert array values to Haskell types that are not instances of IsValue.

Instances3Eq, Show, IsVariant
  • Eq ArrayDefined in dbus-1.4.1 · DBus.Internal.Types
  • Show ArrayDefined in dbus-1.4.1 · DBus.Internal.Types
  • IsVariant ArrayDefined in dbus-1.4.1 · DBus.Internal.Types

Dictionaries

datadata Dictionary
#

A D-Bus Dictionary is a container type similar to Haskell maps, storing zero or more associations between keys and values.

Most users can use the IsVariant instance for maps to extract the values of a dictionary. This type is for advanced use cases, where the user wants to convert dictionary items to Haskell types that are not instances of IsValue.

Instances3Eq, Show, IsVariant

Addresses

11 declarations
datadata Address
#

When a D-Bus server must listen for connections, or a client must connect to a server, the listening socket's configuration is specified with an address. An address contains the method, which determines the protocol and transport mechanism, and parameters, which provide additional method-specific information about the address.

Instances2Eq, Show
  • Eq AddressDefined in dbus-1.4.1 · DBus.Internal.Address
  • Show AddressDefined in dbus-1.4.1 · DBus.Internal.Address

Try to parse a string containing one valid address.

An address string is in the format method:key1=val1,key2=val2. There are some limitations on the characters allowed within methods and parameters; see the D-Bus specification for full details.

Returns the address in the environment variable DBUS_SYSTEM_BUS_ADDRESS, or unix:path=/var/run/dbus/system_bus_socket if DBUS_SYSTEM_BUS_ADDRESS is not set.

Returns Nothing if DBUS_SYSTEM_BUS_ADDRESS contains an invalid address.

Returns the first address in the environment variable DBUS_SESSION_BUS_ADDRESS, which must be set.

Returns Nothing if DBUS_SYSTEM_BUS_ADDRESS contains an invalid address or DBUS_SESSION_BUS_ADDRESS is unset XDG_RUNTIME_DIR doesn't have /bus.

Returns the address in the environment variable DBUS_STARTER_ADDRESS, which must be set.

Returns Nothing if DBUS_STARTER_ADDRESS is unset or contains an invalid address.

Message marshaling

1 declaration

Marshal

Unmarshal

Message serials

newtypenewtype Serial
#

A value used to uniquely identify a particular message within a session. Serials are 32-bit unsigned integers, and eventually wrap.

Instances4Eq, Ord, Show, IsVariant
  • Eq SerialDefined in dbus-1.4.1 · DBus.Internal.Types
  • Ord SerialDefined in dbus-1.4.1 · DBus.Internal.Types
  • Show SerialDefined in dbus-1.4.1 · DBus.Internal.Types
  • IsVariant SerialDefined in dbus-1.4.1 · DBus.Internal.Types

D-Bus UUIDs

3 declarations
newtypenewtype UUID
#

A D-Bus UUID is 128 bits of data, usually randomly generated. They are used for identifying unique server instances to clients.

Older versions of the D-Bus spec also called these values GUIDs.

D-Bus UUIDs are not the same as the RFC-standardized UUIDs or GUIDs.

Instances3Eq, Ord, Show
  • Eq UUIDDefined in dbus-1.4.1 · DBus
  • Ord UUIDDefined in dbus-1.4.1 · DBus
  • Show UUIDDefined in dbus-1.4.1 · DBus
valuerandomUUID :: IO UUID
#

Generate a random D-Bus UUID. This value is suitable for use in a randomly-allocated address, or as a listener's socket address "guid" parameter.