Changed description
from
<<img/FIR_logo.svg>>
[__FIR__](https://gitlab.com/sheaf/fir) is an EDSL
for writing GPU shader code in Haskell, compiled to __@SPIR-V@__.
Requires GHC >= 8.10.
With this library, shader programs can be written using @do@ notation.
Such programs are then transformed into abstract syntax trees (ASTs),
before being compiled to @SPIR-V@ assembly.
In effect, this replaces @GLSL@ as a shader language.
This means the Haskell type-system and type-checker are put to use
in verifying programs at compile-time.
Functional idioms, such as functor and applicative operations, are also supported.
See the [fir-examples](https://gitlab.com/sheaf/fir/tree/0.1/fir-examples)
project subdirectory for fleshed out examples,
including using the @vulkan@ package for rendering.
The exposed modules are:
["FIR"]
Re-exports the main functionality of the library: writing and compiling programs.
["FIR.Syntax.Labels"]
Optional imperative-like syntax using /OverloadedLabels/.
["Math.Linear"]
Vectors, matrices, and operations on them, as used by this library.
["Math.Quaternion"]
Quaternions and their action by conjugation in 3 dimensions, useful for 3D cameras.
Important types used by this library:
[@Code a@]
Code for a pure value of type @a@, represented internally as an abstract syntax tree.
See "FIR.AST".
Overloaded functions are provided that automatically create and combine terms of this type.
For instance, @3 + 5 :: Code Float@ gets desugared to @PrimOp FAdd ( Lit 3.0 ) ( Lit 5.0 )@.
[@Program i j a@]
A monadic expression, starting in state @i@ and ending in state @j@.
This state is used to keep track of information at the type level,
allowing for type errors to be thrown on invalid operations
(e.g. writing to a read-only variable, image sampling outside a fragment shader, etc).
A value of type @Program i j (Code a)@ can be thought of as stateful GPU code
producing a value of type @a@.
Internally represented using the codensity transformation of McBride-style indexed monads, see "Control.Monad.Indexed".
[@Module defs@]
Code for a program that can be compiled to a @SPIR-V@ module.
@defs@ is a type-level list of shader inputs/ouputs (uniforms, varyings, etc),
top-level functions, and entry points.
See "FIR.Module" for the definition, and the [example shaders](https://gitlab.com/sheaf/fir/tree/0.1/fir-examples/readme.md#overview)
for common usage patterns.
Values of all three of these types can be displayed graphically as trees using @showAST@/@drawAST@,
which can be useful for debugging.
See the [project readme](https://gitlab.com/sheaf/fir/tree/0.1/readme.md) for further information,
as well as the ["getting started" guide](https://gitlab.com/sheaf/fir/tree/0.1/getting_started.md),
which includes instructions concerning installation and usage of the library, and of useful tools
such as the @SPIR-V@ tools provided by the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/).
to <<https://gitlab.com/sheaf/fir/-/raw/v0.1.0.0/img/FIR_logo.svg>>
[__FIR__](https://gitlab.com/sheaf/fir) is an EDSL
for writing GPU shader code in Haskell, compiled to __@SPIR-V@__.
Requires GHC >= 8.10.
With this library, shader programs can be written using @do@ notation.
Such programs are then transformed into abstract syntax trees (ASTs),
before being compiled to @SPIR-V@ assembly.
In effect, this replaces @GLSL@ as a shader language.
This means the Haskell type-system and type-checker are put to use
in verifying programs at compile-time.
Functional idioms, such as functor and applicative operations, are also supported.
See the [fir-examples](https://gitlab.com/sheaf/fir/tree/0.1/fir-examples)
project subdirectory for fleshed out examples,
including using the @vulkan@ package for rendering.
The exposed modules are:
["FIR"]
Re-exports the main functionality of the library: writing and compiling programs.
["FIR.Syntax.Labels"]
Optional imperative-like syntax using /OverloadedLabels/.
["Math.Linear"]
Vectors, matrices, and operations on them, as used by this library.
["Math.Quaternion"]
Quaternions and their action by conjugation in 3 dimensions, useful for 3D cameras.
Important types used by this library:
[@Code a@]
Code for a pure value of type @a@, represented internally as an abstract syntax tree.
See "FIR.AST".
Overloaded functions are provided that automatically create and combine terms of this type.
For instance, @3 + 5 :: Code Float@ gets desugared to @PrimOp FAdd ( Lit 3.0 ) ( Lit 5.0 )@.
[@Program i j a@]
A monadic expression, starting in state @i@ and ending in state @j@.
This state is used to keep track of information at the type level,
allowing for type errors to be thrown on invalid operations
(e.g. writing to a read-only variable, image sampling outside a fragment shader, etc).
A value of type @Program i j (Code a)@ can be thought of as stateful GPU code
producing a value of type @a@.
Internally represented using the codensity transformation of McBride-style indexed monads, see "Control.Monad.Indexed".
[@Module defs@]
Code for a program that can be compiled to a @SPIR-V@ module.
@defs@ is a type-level list of shader inputs/ouputs (uniforms, varyings, etc),
top-level functions, and entry points.
See "FIR.Module" for the definition, and the [example shaders](https://gitlab.com/sheaf/fir/tree/0.1/fir-examples/readme.md#overview)
for common usage patterns.
Values of all three of these types can be displayed graphically as trees using @showAST@/@drawAST@,
which can be useful for debugging.
See the [project readme](https://gitlab.com/sheaf/fir/tree/0.1/readme.md) for further information,
as well as the ["getting started" guide](https://gitlab.com/sheaf/fir/tree/0.1/getting_started.md),
which includes instructions concerning installation and usage of the library, and of useful tools
such as the @SPIR-V@ tools provided by the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/).