shady-gen-0.5.1: Functional GPU programming - DSEL & compiler

Stability experimental conal@conal.net

Contents

Description

Misc useful definitions

Synopsis

# Documentation

class FMod a whereSource

Real-valued modulo. You can use `fmodRF` for `RealFrac` types and `fmodViaFrac` for `Frac` types.

Methods

fmod :: a -> a -> aSource

Instances

 FMod Float FMod s => FMod (Complex s) (IsNat n, IsScalar a, FMod a) => FMod (E (Vec n a)) (IsNat n, IsScalar a, FMod a) => FMod (Vec n a)

class Frac a whereSource

Take fractional component(s). Always non-negative. You can use `fracRF` for `RealFrac` types and `fracViaFmod` for `Fmod` types.

Methods

frac :: a -> aSource

Instances

 Frac Float Frac s => Frac (Complex s) (IsNat n, IsScalar a, FMod a, RealFrac a) => Frac (E (Vec n a)) Frac s => Frac (:> u s)

fmodRF :: RealFrac a => a -> a -> aSource

Fractional modulo. Useful for defining `fmod` on `RealFrac` types.

fracRF :: RealFrac a => a -> aSource

Fractional component. Useful for defining `frac` on `RealFrac` types.

fmodViaFrac :: (Fractional a, Frac a) => a -> a -> aSource

Handy defining `fmod` on a `Frac` type.

fracViaFmod :: (Num a, FMod a) => a -> aSource

Handy defining `frac` on a `FMod` type.

clamp :: Ord a => (a, a) -> a -> aSource

Clamp to a given range

clampB :: (IfB bool a, OrdB bool a) => (a, a) -> a -> aSource

Variation on `clamp`, using `OrdB` instead of `Ord`

smoothStep :: (Ord a, Num a) => (a, a) -> a -> aSource

Smooth, clamped transition

type Unop a = a -> aSource

Unary transformation (endomorphism)

type Binop a = a -> a -> aSource

Binary transformation

Pad a string to the given length, adding spaces on the right as needed.

flip1 :: (a -> b) -> a -> bSource

Move first argument to first place (for style uniformity)

flip2 :: (a -> b -> c) -> b -> a -> cSource

Move second argument to first place (`flip` synonym for style uniformity)

flip3 :: (a -> b -> c -> d) -> c -> a -> b -> dSource

Move third argument to first place

flip4 :: (a -> b -> c -> d -> e) -> d -> a -> b -> c -> eSource

Move fourth argument to first place

type Sink a = a -> ActionSource

Sink of information

type Action = IO ()Source

Synonym for `IO ()`. Obviates some parentheses.

(>+>) :: Sink a -> Sink b -> Sink (a, b)Source

Combine sinks

forget :: Functor f => f a -> f ()Source