futhark-manifest-1.1.0.0: Definition and serialisation instances for Futhark manifests.
Safe HaskellNone
LanguageHaskell2010

Futhark.Manifest

Description

C manifest data structure and serialisation to JSON.

A manifest contains machine-readable information about the API of the compiled Futhark program. Specifically which entry points are available, which types are exposed, and what their C names are. This module documentation is not intended as a full description of the Futhark C API - you will need to consult the Futhark User's Guide to understand most of the information here.

The type aliases are purely informative and do not actually enforce correct usage. They are present only because most of the information here is ultimately just text.

Synopsis

Type aliases

type CFuncName = Text Source #

The name of a C function.

type CTypeName = Text Source #

The name of a C type (often of the form "struct foo*").

type TypeName = Text Source #

The name of a Futhark-level type. This may be an array type (without sizes, just empty brackets), a primitive type, or another string denoting an opaque type. The latter must have a corresponding entry in manifestTypes.

Manifest

data Manifest Source #

A manifest for a compiled program.

Constructors

Manifest 

Fields

Instances

Instances details
Eq Manifest Source # 
Instance details

Defined in Futhark.Manifest

Ord Manifest Source # 
Instance details

Defined in Futhark.Manifest

Show Manifest Source # 
Instance details

Defined in Futhark.Manifest

ToJSON Manifest Source # 
Instance details

Defined in Futhark.Manifest

FromJSON Manifest Source # 
Instance details

Defined in Futhark.Manifest

data Input Source #

Manifest info for an entry point parameter.

Constructors

Input 

Instances

Instances details
Eq Input Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: Input -> Input -> Bool #

(/=) :: Input -> Input -> Bool #

Ord Input Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: Input -> Input -> Ordering #

(<) :: Input -> Input -> Bool #

(<=) :: Input -> Input -> Bool #

(>) :: Input -> Input -> Bool #

(>=) :: Input -> Input -> Bool #

max :: Input -> Input -> Input #

min :: Input -> Input -> Input #

Show Input Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> Input -> ShowS #

show :: Input -> String #

showList :: [Input] -> ShowS #

FromJSON Input Source # 
Instance details

Defined in Futhark.Manifest

data Output Source #

Manifest info for an entry point return value.

Constructors

Output 

Instances

Instances details
Eq Output Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: Output -> Output -> Bool #

(/=) :: Output -> Output -> Bool #

Ord Output Source # 
Instance details

Defined in Futhark.Manifest

Show Output Source # 
Instance details

Defined in Futhark.Manifest

FromJSON Output Source # 
Instance details

Defined in Futhark.Manifest

data EntryPoint Source #

Manifest info for an entry point.

data Type Source #

Manifest info for a non-scalar type. Scalar types are not part of the manifest for a program.

Constructors

TypeArray CTypeName TypeName Int ArrayOps

ctype, Futhark elemtype, rank.

TypeOpaque CTypeName OpaqueOps (Maybe RecordOps) 

Instances

Instances details
Eq Type Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Show Type Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

FromJSON Type Source # 
Instance details

Defined in Futhark.Manifest

data ArrayOps Source #

The names of the C functions implementing the operations on some array type.

Instances

Instances details
Eq ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

Ord ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

Show ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

ToJSON ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

FromJSON ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

data RecordField Source #

Information about a record field.

Constructors

RecordField 

Fields

data RecordOps Source #

Some opaque types are records, from which we can extract fields, and also construct them from values for their fields. Beyond that, they support the usual opaque operations. These record facilities can be ignored if you wish, and the types treated as ordinary opaque types.

Constructors

RecordOps 

Fields

data OpaqueOps Source #

The names of the C functions implementing the operations on some opaque type.

manifestToJSON :: Manifest -> Text Source #

Serialise a manifest to JSON.

manifestFromJSON :: Text -> Maybe Manifest Source #

Read a manifest from JSON. Returns Nothing if the text does not describe a Manifest.