downhill-0.1.0.0: Reverse mode automatic differentiation
Safe HaskellNone
LanguageHaskell2010

Downhill.TH

Description

Use like this:

mkHasGradInstances
  defaultBVarOptions
  [d|
    instance HasGrad MyRecord where
      type MScalar MyRecord = Float
    |]

Instance declaration passed to mkHasGradInstances gives two important bits of information:

  • Type variables for MyRecord, which can be concrete types (such as instance HasGrad (MyRecord Float)) or regular type variables (instance HasGrad (MyRecord a))
  • Scalar type.
Synopsis

Documentation

mkHasGradInstances :: BVarOptions -> Q [Dec] -> Q [Dec] Source #

Generates HasGrad instance, along with Tang and Grad types, VecBuilder types and all other instances needed for HasGrad.

data AffineSpaceOptions Source #

Constructors

MakeAffineSpace

Generate AffineSpace instance

NoAffineSpace

Don't generate AffineSpace instance

AutoAffineSpace

Generate AffineSpace instance if optExcludeFields is empty