Safe Haskell | None |
---|---|
Language | Haskell2010 |
Graphics.QML.Marshal
Description
Type classs and instances for marshalling values between Haskell and QML.
- class Marshal t where
- type MarshalMode t c d
- marshaller :: MarshallerFor t
- type family ModeBidi c
- type family ModeFrom c
- type family ModeRetVoid c
- type family ModeObjBidi a c
- type family ModeObjFrom a c
- data Yes
- type CanGetFrom t = MarshalMode t ICanGetFrom ()
- data ICanGetFrom
- type CanPassTo t = MarshalMode t ICanPassTo ()
- data ICanPassTo
- type CanReturnTo t = MarshalMode t ICanReturnTo ()
- data ICanReturnTo
- type IsObjType t = MarshalMode t IIsObjType ()
- data IIsObjType
- type GetObjType t = MarshalMode t IGetObjType ()
- data IGetObjType
- data Marshaller t u v w x y
- bidiMarshallerIO :: forall a b. (Marshal a, CanGetFrom a ~ Yes, CanPassTo a ~ Yes) => (a -> IO b) -> (b -> IO a) -> BidiMarshaller a b
- bidiMarshaller :: forall a b. (Marshal a, CanGetFrom a ~ Yes, CanPassTo a ~ Yes) => (a -> b) -> (b -> a) -> BidiMarshaller a b
- fromMarshallerIO :: forall a b. (Marshal a, CanGetFrom a ~ Yes) => (a -> IO b) -> FromMarshaller a b
- fromMarshaller :: forall a b. (Marshal a, CanGetFrom a ~ Yes) => (a -> b) -> FromMarshaller a b
Marshalling Type-class
class Marshal t where
The class Marshal
allows Haskell values to be marshalled to and from the
QML environment.
Associated Types
type MarshalMode t c d
The MarshalMode
associated type family specifies the marshalling
capabilities offered by the instance. c
indicates the capability being
queried. d
is dummy parameter which allows certain instances to type
check.
type family ModeBidi c
MarshalMode
for non-object types with bidirectional marshalling.
Instances
type ModeBidi IGetObjType | |
type ModeBidi IIsObjType | |
type ModeBidi ICanReturnTo = Yes | |
type ModeBidi ICanPassTo = Yes | |
type ModeBidi ICanGetFrom = Yes |
type family ModeFrom c
MarshalMode
for non-object types with from-only marshalling.
Instances
type ModeFrom IGetObjType | |
type ModeFrom IIsObjType | |
type ModeFrom ICanReturnTo | |
type ModeFrom ICanPassTo | |
type ModeFrom ICanGetFrom = Yes |
type family ModeRetVoid c
MarshalMode
for void in method returns.
Instances
type ModeRetVoid IGetObjType | |
type ModeRetVoid IIsObjType | |
type ModeRetVoid ICanReturnTo = Yes | |
type ModeRetVoid ICanPassTo | |
type ModeRetVoid ICanGetFrom |
type family ModeObjBidi a c
MarshalMode
for object types with bidirectional marshalling.
Instances
type ModeObjBidi a IGetObjType = a | |
type ModeObjBidi a IIsObjType = Yes | |
type ModeObjBidi a ICanReturnTo = Yes | |
type ModeObjBidi a ICanPassTo = Yes | |
type ModeObjBidi a ICanGetFrom = Yes |
type family ModeObjFrom a c
MarshalMode
for object types with from-only marshalling.
Instances
type ModeObjFrom a IGetObjType = a | |
type ModeObjFrom a IIsObjType = Yes | |
type ModeObjFrom a ICanReturnTo | |
type ModeObjFrom a ICanPassTo | |
type ModeObjFrom a ICanGetFrom = Yes |
data Yes
Type value indicating a capability is supported.
type CanGetFrom t = MarshalMode t ICanGetFrom ()
Type function equal to Yes
if the marshallable type t
supports being
received from QML.
data ICanGetFrom
Type index into MarshalMode
for querying if the mode supports receiving
values from QML.
Instances
type ModeRetVoid ICanGetFrom | |
type ModeFrom ICanGetFrom = Yes | |
type ModeBidi ICanGetFrom = Yes | |
type ModeObjFrom a ICanGetFrom = Yes | |
type ModeObjBidi a ICanGetFrom = Yes | |
type MarshalMode [a] ICanGetFrom d = MarshalMode a ICanGetFrom d | |
type MarshalMode (Maybe a) ICanGetFrom d = MarshalMode a ICanGetFrom d |
type CanPassTo t = MarshalMode t ICanPassTo ()
Type function equal to Yes
if the marshallable type t
supports being
passed to QML.
data ICanPassTo
Type index into MarshalMode
for querying if the mode supports passing
values to QML.
Instances
type ModeRetVoid ICanPassTo | |
type ModeFrom ICanPassTo | |
type ModeBidi ICanPassTo = Yes | |
type ModeObjFrom a ICanPassTo | |
type ModeObjBidi a ICanPassTo = Yes | |
type MarshalMode [a] ICanPassTo d = MarshalMode a ICanPassTo d | |
type MarshalMode (Maybe a) ICanPassTo d = MarshalMode a ICanPassTo d |
type CanReturnTo t = MarshalMode t ICanReturnTo ()
Type function equal to Yes
if the marshallable type t
supports being
returned to QML.
data ICanReturnTo
Type index into MarshalMode
for querying if the mode supports returning
values to QML.
Instances
type ModeRetVoid ICanReturnTo = Yes | |
type ModeFrom ICanReturnTo | |
type ModeBidi ICanReturnTo = Yes | |
type ModeObjFrom a ICanReturnTo | |
type ModeObjBidi a ICanReturnTo = Yes | |
type MarshalMode [a] ICanReturnTo d = MarshalMode a ICanReturnTo d | |
type MarshalMode (Maybe a) ICanReturnTo d = MarshalMode a ICanReturnTo d |
type IsObjType t = MarshalMode t IIsObjType ()
Type function equal to Yes
if the marshallable type t
is an object.
data IIsObjType
Type index into MarshalMode
for querying if the mode supports an object
type.
Instances
type ModeRetVoid IIsObjType | |
type ModeFrom IIsObjType | |
type ModeBidi IIsObjType | |
type ModeObjFrom a IIsObjType = Yes | |
type ModeObjBidi a IIsObjType = Yes | |
type MarshalMode [a] IIsObjType d | |
type MarshalMode (Maybe a) IIsObjType d |
type GetObjType t = MarshalMode t IGetObjType ()
Type function which returns the type encapsulated by the object handles
used by the marshallable type t
.
data IGetObjType
Type index into MarshalMode
for querying the type encapsulated by the
mode's object handles.
Instances
type ModeRetVoid IGetObjType | |
type ModeFrom IGetObjType | |
type ModeBidi IGetObjType | |
type ModeObjFrom a IGetObjType = a | |
type ModeObjBidi a IGetObjType = a | |
type MarshalMode [a] IGetObjType d | |
type MarshalMode (Maybe a) IGetObjType d |
data Marshaller t u v w x y
Encapsulates the functionality to needed to implement an instance of
Marshal
so that such instances can be defined without access to
implementation details.
Custom Marshallers
bidiMarshallerIO :: forall a b. (Marshal a, CanGetFrom a ~ Yes, CanPassTo a ~ Yes) => (a -> IO b) -> (b -> IO a) -> BidiMarshaller a b
Provides a bidirectional Marshaller
which allows you to define an
instance of Marshal
for your own type b
in terms of another marshallable
type a
. Type b
should have a MarshalMode
of ModeObjBidi
or
ModeBidi
depending on whether a
was an object type or not.
bidiMarshaller :: forall a b. (Marshal a, CanGetFrom a ~ Yes, CanPassTo a ~ Yes) => (a -> b) -> (b -> a) -> BidiMarshaller a b
Variant of bidiMarshallerIO
where the conversion functions between types
a
and b
do not live in the IO monad.
fromMarshallerIO :: forall a b. (Marshal a, CanGetFrom a ~ Yes) => (a -> IO b) -> FromMarshaller a b
Provides a "from" Marshaller
which allows you to define an instance of
Marshal
for your own type b
in terms of another marshallable type a
.
Type b
should have a MarshalMode
of ModeObjFrom
or ModeFrom
depending on whether a
was an object type or not.
fromMarshaller :: forall a b. (Marshal a, CanGetFrom a ~ Yes) => (a -> b) -> FromMarshaller a b
Variant of fromMarshallerIO
where the conversion function between types
a
and b
does not live in the IO monad.