backprop-learn-0.1.0.0: Combinators and useful tools for ANNs using the backprop library

Copyright(c) Justin Le 2018
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Type.Tuple

Contents

Description

If you are writing a library that needs to export BVars of tuples, consider using the tuples in this module so that your library can have easy interoperability with other libraries using backprop.

Because of API decisions, backprop and gradBP only work with things with Num instances. However, this disallows default Prelude tuples (without orphan instances from packages like NumInstances).

Until tuples have Num instances in base, this module is intended to be a workaround for situations where:

This comes up often in cases where:

  1. A function wants to return more than one value (BVar s (T2 a b)
  2. You want to uncurry a BVar function to use with backprop and gradBP.
  3. You want to use the useful Prisms automatically generated by the lens library, which use tuples for multiple-constructor fields.

Only 2-tuples and 3-tuples are provided. Any more and you should probably be using your own custom product types, with instances automatically generated from something like one-liner-instances.

Lenses into the fields are provided, but they also work with _1, _2, and _3 from Lens.Micro. However, note that these are incompatible with _1, _2, and _3 from Control.Lens.

You can "construct" a BVar s (T2 a b) with functions like isoVar.

Since: 0.1.1.0

Synopsis

Zero-tuples (unit)

data T0 Source #

Unit ('()') with Num, Fractional, and Floating instances.

Be aware that the methods in its numerical instances are all non-strict:

_ + _ = T0
negate _ = T0
fromIntegral _ = T0

Since: 0.1.4.0

Constructors

T0 
Instances
Eq T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

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

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

Floating T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

pi :: T0 #

exp :: T0 -> T0 #

log :: T0 -> T0 #

sqrt :: T0 -> T0 #

(**) :: T0 -> T0 -> T0 #

logBase :: T0 -> T0 -> T0 #

sin :: T0 -> T0 #

cos :: T0 -> T0 #

tan :: T0 -> T0 #

asin :: T0 -> T0 #

acos :: T0 -> T0 #

atan :: T0 -> T0 #

sinh :: T0 -> T0 #

cosh :: T0 -> T0 #

tanh :: T0 -> T0 #

asinh :: T0 -> T0 #

acosh :: T0 -> T0 #

atanh :: T0 -> T0 #

log1p :: T0 -> T0 #

expm1 :: T0 -> T0 #

log1pexp :: T0 -> T0 #

log1mexp :: T0 -> T0 #

Fractional T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(/) :: T0 -> T0 -> T0 #

recip :: T0 -> T0 #

fromRational :: Rational -> T0 #

Data T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> T0 -> c T0 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c T0 #

toConstr :: T0 -> Constr #

dataTypeOf :: T0 -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c T0) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c T0) #

gmapT :: (forall b. Data b => b -> b) -> T0 -> T0 #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> T0 -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> T0 -> r #

gmapQ :: (forall d. Data d => d -> u) -> T0 -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> T0 -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> T0 -> m T0 #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> T0 -> m T0 #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> T0 -> m T0 #

Num T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(+) :: T0 -> T0 -> T0 #

(-) :: T0 -> T0 -> T0 #

(*) :: T0 -> T0 -> T0 #

negate :: T0 -> T0 #

abs :: T0 -> T0 #

signum :: T0 -> T0 #

fromInteger :: Integer -> T0 #

Ord T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

compare :: T0 -> T0 -> Ordering #

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

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

(>) :: T0 -> T0 -> Bool #

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

max :: T0 -> T0 -> T0 #

min :: T0 -> T0 -> T0 #

Read T0 Source # 
Instance details

Defined in Data.Type.Tuple

Show T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

showsPrec :: Int -> T0 -> ShowS #

show :: T0 -> String #

showList :: [T0] -> ShowS #

Generic T0 Source # 
Instance details

Defined in Data.Type.Tuple

Associated Types

type Rep T0 :: Type -> Type #

Methods

from :: T0 -> Rep T0 x #

to :: Rep T0 x -> T0 #

Semigroup T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(<>) :: T0 -> T0 -> T0 #

sconcat :: NonEmpty T0 -> T0 #

stimes :: Integral b => b -> T0 -> T0 #

Monoid T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

mempty :: T0 #

mappend :: T0 -> T0 -> T0 #

mconcat :: [T0] -> T0 #

NFData T0 Source # 
Instance details

Defined in Data.Type.Tuple

Methods

rnf :: T0 -> () #

Binary T0 Source #

Since: 0.1.5.1

Instance details

Defined in Data.Type.Tuple

Methods

put :: T0 -> Put #

get :: Get T0 #

putList :: [T0] -> Put #

Initialize T0 Source # 
Instance details

Defined in Backprop.Learn.Initialize

Methods

initialize :: (ContGen d, PrimMonad m) => d -> Gen (PrimState m) -> m T0 Source #

type Rep T0 Source # 
Instance details

Defined in Data.Type.Tuple

type Rep T0 = D1 (MetaData "T0" "Data.Type.Tuple" "backprop-learn-0.1.0.0-LYs2l1OGpKTGmGWQXOoOXm" False) (C1 (MetaCons "T0" PrefixI False) (U1 :: Type -> Type))

Two-tuples

data a :# b infixr 1 Source #

Strict 2-tuple with Num, Fractional, and Floating instances.

Since: 0.1.1.0

Constructors

!a :# !b infixr 1 
Instances
Bifunctor (:#) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

bimap :: (a -> b) -> (c -> d) -> (a :# c) -> b :# d #

first :: (a -> b) -> (a :# c) -> b :# c #

second :: (b -> c) -> (a :# b) -> a :# c #

(LinearInPlace m c a, LinearInPlace m c b) => LinearInPlace m c (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(.+.=) :: Ref m (a :# b) -> (a :# b) -> m () #

(.*=) :: Ref m (a :# b) -> c -> m () #

(.*+=) :: Ref m (a :# b) -> (c, a :# b) -> m () #

(Linear c a, Linear c b) => Linear c (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(.+.) :: (a :# b) -> (a :# b) -> a :# b #

zeroL :: a :# b #

(.*) :: c -> (a :# b) -> a :# b #

(Floating c, Ord c, Metric c a, Metric c b) => Metric c (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(<.>) :: (a :# b) -> (a :# b) -> c #

norm_inf :: (a :# b) -> c #

norm_0 :: (a :# b) -> c #

norm_1 :: (a :# b) -> c #

norm_2 :: (a :# b) -> c #

quadrance :: (a :# b) -> c #

(Mutable m a, Mutable m b) => Mutable m (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Associated Types

type Ref m (a :# b) = (v :: Type) #

Methods

thawRef :: (a :# b) -> m (Ref m (a :# b)) #

freezeRef :: Ref m (a :# b) -> m (a :# b) #

copyRef :: Ref m (a :# b) -> (a :# b) -> m () #

modifyRef :: Ref m (a :# b) -> ((a :# b) -> a :# b) -> m () #

modifyRef' :: Ref m (a :# b) -> ((a :# b) -> a :# b) -> m () #

updateRef :: Ref m (a :# b) -> ((a :# b) -> (a :# b, b0)) -> m b0 #

updateRef' :: Ref m (a :# b) -> ((a :# b) -> (a :# b, b0)) -> m b0 #

(Initialize a, Initialize b, Regularize a, Regularize b, Binary a, Binary b, NFData a, NFData b, LinearInPlace m Double a, LinearInPlace m Double b) => Learnable m (a :# b) Source # 
Instance details

Defined in Backprop.Learn.Model.Types

Functor ((:#) a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

fmap :: (a0 -> b) -> (a :# a0) -> a :# b #

(<$) :: a0 -> (a :# b) -> a :# a0 #

(Eq a, Eq b) => Eq (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(==) :: (a :# b) -> (a :# b) -> Bool #

(/=) :: (a :# b) -> (a :# b) -> Bool #

(Floating a, Floating b) => Floating (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

pi :: a :# b #

exp :: (a :# b) -> a :# b #

log :: (a :# b) -> a :# b #

sqrt :: (a :# b) -> a :# b #

(**) :: (a :# b) -> (a :# b) -> a :# b #

logBase :: (a :# b) -> (a :# b) -> a :# b #

sin :: (a :# b) -> a :# b #

cos :: (a :# b) -> a :# b #

tan :: (a :# b) -> a :# b #

asin :: (a :# b) -> a :# b #

acos :: (a :# b) -> a :# b #

atan :: (a :# b) -> a :# b #

sinh :: (a :# b) -> a :# b #

cosh :: (a :# b) -> a :# b #

tanh :: (a :# b) -> a :# b #

asinh :: (a :# b) -> a :# b #

acosh :: (a :# b) -> a :# b #

atanh :: (a :# b) -> a :# b #

log1p :: (a :# b) -> a :# b #

expm1 :: (a :# b) -> a :# b #

log1pexp :: (a :# b) -> a :# b #

log1mexp :: (a :# b) -> a :# b #

(Fractional a, Fractional b) => Fractional (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(/) :: (a :# b) -> (a :# b) -> a :# b #

recip :: (a :# b) -> a :# b #

fromRational :: Rational -> a :# b #

(Data a, Data b) => Data (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> (a :# b) -> c (a :# b) #

gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (a :# b) #

toConstr :: (a :# b) -> Constr #

dataTypeOf :: (a :# b) -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (a :# b)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (a :# b)) #

gmapT :: (forall b0. Data b0 => b0 -> b0) -> (a :# b) -> a :# b #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> (a :# b) -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> (a :# b) -> r #

gmapQ :: (forall d. Data d => d -> u) -> (a :# b) -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> (a :# b) -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> (a :# b) -> m (a :# b) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> (a :# b) -> m (a :# b) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> (a :# b) -> m (a :# b) #

(Num a, Num b) => Num (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(+) :: (a :# b) -> (a :# b) -> a :# b #

(-) :: (a :# b) -> (a :# b) -> a :# b #

(*) :: (a :# b) -> (a :# b) -> a :# b #

negate :: (a :# b) -> a :# b #

abs :: (a :# b) -> a :# b #

signum :: (a :# b) -> a :# b #

fromInteger :: Integer -> a :# b #

(Ord a, Ord b) => Ord (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

compare :: (a :# b) -> (a :# b) -> Ordering #

(<) :: (a :# b) -> (a :# b) -> Bool #

(<=) :: (a :# b) -> (a :# b) -> Bool #

(>) :: (a :# b) -> (a :# b) -> Bool #

(>=) :: (a :# b) -> (a :# b) -> Bool #

max :: (a :# b) -> (a :# b) -> a :# b #

min :: (a :# b) -> (a :# b) -> a :# b #

(Read a, Read b) => Read (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

readsPrec :: Int -> ReadS (a :# b) #

readList :: ReadS [a :# b] #

readPrec :: ReadPrec (a :# b) #

readListPrec :: ReadPrec [a :# b] #

(Show a, Show b) => Show (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

showsPrec :: Int -> (a :# b) -> ShowS #

show :: (a :# b) -> String #

showList :: [a :# b] -> ShowS #

Generic (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Associated Types

type Rep (a :# b) :: Type -> Type #

Methods

from :: (a :# b) -> Rep (a :# b) x #

to :: Rep (a :# b) x -> a :# b #

(Semigroup a, Semigroup b) => Semigroup (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(<>) :: (a :# b) -> (a :# b) -> a :# b #

sconcat :: NonEmpty (a :# b) -> a :# b #

stimes :: Integral b0 => b0 -> (a :# b) -> a :# b #

(Semigroup a, Semigroup b, Monoid a, Monoid b) => Monoid (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

mempty :: a :# b #

mappend :: (a :# b) -> (a :# b) -> a :# b #

mconcat :: [a :# b] -> a :# b #

(NFData a, NFData b) => NFData (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

rnf :: (a :# b) -> () #

(Backprop a, Backprop b) => Backprop (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

zero :: (a :# b) -> a :# b #

add :: (a :# b) -> (a :# b) -> a :# b #

one :: (a :# b) -> a :# b #

(Binary a, Binary b) => Binary (a :# b) Source #

Since: 0.1.5.1

Instance details

Defined in Data.Type.Tuple

Methods

put :: (a :# b) -> Put #

get :: Get (a :# b) #

putList :: [a :# b] -> Put #

(Regularize a, Regularize b) => Regularize (a :# b) Source # 
Instance details

Defined in Backprop.Learn.Regularize

Methods

rnorm_1 :: (a :# b) -> Double Source #

rnorm_2 :: (a :# b) -> Double Source #

lasso :: Double -> (a :# b) -> a :# b Source #

ridge :: Double -> (a :# b) -> a :# b Source #

(Initialize a, Initialize b) => Initialize (a :# b) Source # 
Instance details

Defined in Backprop.Learn.Initialize

Methods

initialize :: (ContGen d, PrimMonad m) => d -> Gen (PrimState m) -> m (a :# b) Source #

Field1 (a :# b) (a' :# b) a a' Source # 
Instance details

Defined in Data.Type.Tuple

Methods

_1 :: Lens (a :# b) (a' :# b) a a' #

Field2 (a :# b) (a :# b') b b' Source # 
Instance details

Defined in Data.Type.Tuple

Methods

_2 :: Lens (a :# b) (a :# b') b b' #

type Ref m (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

type Ref m (a :# b) = GRef m (a :# b)
type Rep (a :# b) Source # 
Instance details

Defined in Data.Type.Tuple

type Rep (a :# b) = D1 (MetaData ":#" "Data.Type.Tuple" "backprop-learn-0.1.0.0-LYs2l1OGpKTGmGWQXOoOXm" False) (C1 (MetaCons ":#" (InfixI RightAssociative 1) False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)))

pattern (:##) :: (Backprop a, Backprop b, Reifies s W) => BVar s a -> BVar s b -> BVar s (a :# b) Source #

Conversions

t2Tup :: (a :# b) -> (a, b) Source #

Convert to a Haskell tuple.

Forms an isomorphism with tupT2.

tupT2 :: (a, b) -> a :# b Source #

Convert from Haskell tuple.

Forms an isomorphism with t2Tup.

Consumption

uncurryT2 :: (a -> b -> c) -> (a :# b) -> c Source #

Uncurry a function to take in a T2 of its arguments

Since: 0.1.2.0

curryT2 :: ((a :# b) -> c) -> a -> b -> c Source #

Curry a function taking a T2 of its arguments

Since: 0.1.2.0

Lenses

t2_1 :: Lens (a :# b) (a' :# b) a a' Source #

Lens into the first field of a T2. Also exported as _1 from Lens.Micro.

t2_2 :: Lens (a :# b) (a :# b') b b' Source #

Lens into the second field of a T2. Also exported as _2 from Lens.Micro.

N-Tuples

type T = Rec TF Source #

Strict inductive N-tuple with a Num, Fractional, and Floating instances.

It is basically "yet another HList", like the one found in Data.Type.Product and many other locations on the haskell ecosystem. Because it's inductively defined, it has O(n) random indexing, but is efficient for zipping and mapping and other sequential consumption patterns.

It is provided because of its Num instance, making it useful for backproup. Will be obsolete when Product gets numerical instances.

Since: 0.1.5.0

newtype TF a Source #

Constructors

TF 

Fields

Instances
(Mutable m a, LinearInPlace m c a) => LinearInPlace m c (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(.+.=) :: Ref m (TF a) -> TF a -> m () #

(.*=) :: Ref m (TF a) -> c -> m () #

(.*+=) :: Ref m (TF a) -> (c, TF a) -> m () #

Linear c a => Linear c (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(.+.) :: TF a -> TF a -> TF a #

zeroL :: TF a #

(.*) :: c -> TF a -> TF a #

(Ord c, Floating c, Metric c a) => Metric c (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(<.>) :: TF a -> TF a -> c #

norm_inf :: TF a -> c #

norm_0 :: TF a -> c #

norm_1 :: TF a -> c #

norm_2 :: TF a -> c #

quadrance :: TF a -> c #

Mutable m a => Mutable m (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Associated Types

type Ref m (TF a) = (v :: Type) #

Methods

thawRef :: TF a -> m (Ref m (TF a)) #

freezeRef :: Ref m (TF a) -> m (TF a) #

copyRef :: Ref m (TF a) -> TF a -> m () #

modifyRef :: Ref m (TF a) -> (TF a -> TF a) -> m () #

modifyRef' :: Ref m (TF a) -> (TF a -> TF a) -> m () #

updateRef :: Ref m (TF a) -> (TF a -> (TF a, b)) -> m b #

updateRef' :: Ref m (TF a) -> (TF a -> (TF a, b)) -> m b #

(Initialize a, Regularize a, Binary a, NFData a, LinearInPlace m Double a) => Learnable m (TF a) Source # 
Instance details

Defined in Backprop.Learn.Model.Types

(RPureConstrained Initialize as, RPureConstrained Regularize as, RPureConstrained Binary as, RPureConstrained NFData as, ReifyConstraint Backprop TF as, RMap as, RApply as, RFoldMap as, RecordToList as, LinearInPlace m Double (Rec TF as)) => Learnable m (Rec TF as) Source # 
Instance details

Defined in Backprop.Learn.Model.Types

Eq a => Eq (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(==) :: TF a -> TF a -> Bool #

(/=) :: TF a -> TF a -> Bool #

Floating a => Floating (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

pi :: TF a #

exp :: TF a -> TF a #

log :: TF a -> TF a #

sqrt :: TF a -> TF a #

(**) :: TF a -> TF a -> TF a #

logBase :: TF a -> TF a -> TF a #

sin :: TF a -> TF a #

cos :: TF a -> TF a #

tan :: TF a -> TF a #

asin :: TF a -> TF a #

acos :: TF a -> TF a #

atan :: TF a -> TF a #

sinh :: TF a -> TF a #

cosh :: TF a -> TF a #

tanh :: TF a -> TF a #

asinh :: TF a -> TF a #

acosh :: TF a -> TF a #

atanh :: TF a -> TF a #

log1p :: TF a -> TF a #

expm1 :: TF a -> TF a #

log1pexp :: TF a -> TF a #

log1mexp :: TF a -> TF a #

(RPureConstrained Num as, RPureConstrained Fractional as, RPureConstrained Floating as, RMap as, RApply as) => Floating (T as) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

pi :: T as #

exp :: T as -> T as #

log :: T as -> T as #

sqrt :: T as -> T as #

(**) :: T as -> T as -> T as #

logBase :: T as -> T as -> T as #

sin :: T as -> T as #

cos :: T as -> T as #

tan :: T as -> T as #

asin :: T as -> T as #

acos :: T as -> T as #

atan :: T as -> T as #

sinh :: T as -> T as #

cosh :: T as -> T as #

tanh :: T as -> T as #

asinh :: T as -> T as #

acosh :: T as -> T as #

atanh :: T as -> T as #

log1p :: T as -> T as #

expm1 :: T as -> T as #

log1pexp :: T as -> T as #

log1mexp :: T as -> T as #

Fractional a => Fractional (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(/) :: TF a -> TF a -> TF a #

recip :: TF a -> TF a #

fromRational :: Rational -> TF a #

(RPureConstrained Num as, RPureConstrained Fractional as, RMap as, RApply as) => Fractional (T as) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(/) :: T as -> T as -> T as #

recip :: T as -> T as #

fromRational :: Rational -> T as #

Num a => Num (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(+) :: TF a -> TF a -> TF a #

(-) :: TF a -> TF a -> TF a #

(*) :: TF a -> TF a -> TF a #

negate :: TF a -> TF a #

abs :: TF a -> TF a #

signum :: TF a -> TF a #

fromInteger :: Integer -> TF a #

Ord a => Ord (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

compare :: TF a -> TF a -> Ordering #

(<) :: TF a -> TF a -> Bool #

(<=) :: TF a -> TF a -> Bool #

(>) :: TF a -> TF a -> Bool #

(>=) :: TF a -> TF a -> Bool #

max :: TF a -> TF a -> TF a #

min :: TF a -> TF a -> TF a #

Show a => Show (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

showsPrec :: Int -> TF a -> ShowS #

show :: TF a -> String #

showList :: [TF a] -> ShowS #

Generic (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Associated Types

type Rep (TF a) :: Type -> Type #

Methods

from :: TF a -> Rep (TF a) x #

to :: Rep (TF a) x -> TF a #

NFData a => NFData (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

rnf :: TF a -> () #

PureProdC Maybe Backprop as => Backprop (TMaybe as) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

zero :: TMaybe as -> TMaybe as #

add :: TMaybe as -> TMaybe as -> TMaybe as #

one :: TMaybe as -> TMaybe as #

Backprop a => Backprop (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

zero :: TF a -> TF a #

add :: TF a -> TF a -> TF a #

one :: TF a -> TF a #

Binary a => Binary (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

put :: TF a -> Put #

get :: Get (TF a) #

putList :: [TF a] -> Put #

Regularize a => Regularize (TF a) Source # 
Instance details

Defined in Backprop.Learn.Regularize

Methods

rnorm_1 :: TF a -> Double Source #

rnorm_2 :: TF a -> Double Source #

lasso :: Double -> TF a -> TF a Source #

ridge :: Double -> TF a -> TF a Source #

Initialize a => Initialize (TF a) Source # 
Instance details

Defined in Backprop.Learn.Initialize

Methods

initialize :: (ContGen d, PrimMonad m) => d -> Gen (PrimState m) -> m (TF a) Source #

RPureConstrained Initialize as => Initialize (T as) Source # 
Instance details

Defined in Backprop.Learn.Initialize

Methods

initialize :: (ContGen d, PrimMonad m) => d -> Gen (PrimState m) -> m (T as) Source #

Field1 (T (a ': as)) (T (a ': as)) a a Source # 
Instance details

Defined in Data.Type.Tuple

Methods

_1 :: Lens (T (a ': as)) (T (a ': as)) a a #

Field2 (T (a ': (b ': as))) (T (a ': (b ': as))) b b Source # 
Instance details

Defined in Data.Type.Tuple

Methods

_2 :: Lens (T (a ': (b ': as))) (T (a ': (b ': as))) b b #

Field3 (T (a ': (b ': (c ': as)))) (T (a ': (b ': (c ': as)))) c c Source # 
Instance details

Defined in Data.Type.Tuple

Methods

_3 :: Lens (T (a ': (b ': (c ': as)))) (T (a ': (b ': (c ': as)))) c c #

(RPureConstrained Num as, RMap as, RApply as) => Num (Rec TF as) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

(+) :: Rec TF as -> Rec TF as -> Rec TF as #

(-) :: Rec TF as -> Rec TF as -> Rec TF as #

(*) :: Rec TF as -> Rec TF as -> Rec TF as #

negate :: Rec TF as -> Rec TF as #

abs :: Rec TF as -> Rec TF as #

signum :: Rec TF as -> Rec TF as #

fromInteger :: Integer -> Rec TF as #

RPureConstrained NFData as => NFData (Rec TF as) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

rnf :: Rec TF as -> () #

(RPureConstrained Binary as, RMap as, RApply as, RecordToList as) => Binary (Rec TF as) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

put :: Rec TF as -> Put #

get :: Get (Rec TF as) #

putList :: [Rec TF as] -> Put #

(RPureConstrained Regularize as, ReifyConstraint Backprop TF as, RMap as, RApply as, RFoldMap as) => Regularize (Rec TF as) Source # 
Instance details

Defined in Backprop.Learn.Regularize

Methods

rnorm_1 :: Rec TF as -> Double Source #

rnorm_2 :: Rec TF as -> Double Source #

lasso :: Double -> Rec TF as -> Rec TF as Source #

ridge :: Double -> Rec TF as -> Rec TF as Source #

(PureProdC Maybe Backprop as, PureProdC Maybe Regularize as) => Regularize (PMaybe TF as) Source # 
Instance details

Defined in Backprop.Learn.Regularize

type Ref m (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

type Ref m (TF a) = TF (Ref m a)
type Rep (TF a) Source # 
Instance details

Defined in Data.Type.Tuple

type Rep (TF a) = D1 (MetaData "TF" "Data.Type.Tuple" "backprop-learn-0.1.0.0-LYs2l1OGpKTGmGWQXOoOXm" True) (C1 (MetaCons "TF" PrefixI True) (S1 (MetaSel (Just "getTF") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))

pattern (:&&) :: a -> T as -> T (a ': as) infixr 5 Source #

indexT :: Index as a -> T as -> a Source #

Index into a T.

O(i)

Since: 0.1.5.0

Conversions

tOnly :: T '[a] -> a Source #

Extract a singleton T

Forms an isomorphism with onlyT

Since: 0.1.5.0

onlyT :: a -> T '[a] Source #

A singleton T

Forms an isomorphism with tOnly

Since: 0.1.5.0

Lenses

tHead :: Lens (T (a ': as)) (T (b ': as)) a b Source #

Lens into the head of a T

Since: 0.1.5.0

tTail :: Lens (T (a ': as)) (T (a ': bs)) (T as) (T bs) Source #

Lens into the tail of a T

Since: 0.1.5.0

Maybe

data PMaybe (a :: k -> Type) (b :: Maybe k) :: forall k. (k -> Type) -> Maybe k -> Type where #

A PMaybe f 'Nothing contains nothing, and a PMaybe f ('Just a) contains an f a.

In practice this can be useful to write polymorphic functions/abstractions that contain an argument that can be "turned off" for different instances.

Constructors

PNothing :: forall k (a :: k -> Type) (b :: Maybe k). PMaybe a (Nothing :: Maybe k) 
PJust :: forall k (a :: k -> Type) (b :: Maybe k) (a1 :: k). a a1 -> PMaybe a (Just a1) 

Bundled Patterns

pattern TJust :: a -> TMaybe (Just a) 
Instances
PureProdC Maybe Backprop as => Backprop (TMaybe as) Source # 
Instance details

Defined in Data.Type.Tuple

Methods

zero :: TMaybe as -> TMaybe as #

add :: TMaybe as -> TMaybe as -> TMaybe as #

one :: TMaybe as -> TMaybe as #

Decidable (TyPred (PMaybe (Sing :: k -> Type)) :: Predicate (Maybe k))

Since: decidable-2.0.0

Instance details

Defined in Data.Type.Predicate

Provable (TyPred (PMaybe (Sing :: k -> Type)) :: Predicate (Maybe k))

Since: decidable-2.0.0

Instance details

Defined in Data.Type.Predicate

Methods

prove :: Prove (TyPred (PMaybe Sing)) #

SingI as => Auto (TyPred (PMaybe (Sing :: k -> Type)) :: Predicate (Maybe k)) (as :: Maybe k)

Since: decidable-2.0.0

Instance details

Defined in Data.Type.Predicate.Auto

Methods

auto :: TyPred (PMaybe Sing) @@ as #

ReifyConstraintProd Maybe Eq f as => Eq (PMaybe f as) 
Instance details

Defined in Data.Type.Functor.Product

Methods

(==) :: PMaybe f as -> PMaybe f as -> Bool #

(/=) :: PMaybe f as -> PMaybe f as -> Bool #

(ReifyConstraintProd Maybe Eq f as, ReifyConstraintProd Maybe Ord f as) => Ord (PMaybe f as) 
Instance details

Defined in Data.Type.Functor.Product

Methods

compare :: PMaybe f as -> PMaybe f as -> Ordering #

(<) :: PMaybe f as -> PMaybe f as -> Bool #

(<=) :: PMaybe f as -> PMaybe f as -> Bool #

(>) :: PMaybe f as -> PMaybe f as -> Bool #

(>=) :: PMaybe f as -> PMaybe f as -> Bool #

max :: PMaybe f as -> PMaybe f as -> PMaybe f as #

min :: PMaybe f as -> PMaybe f as -> PMaybe f as #

ReifyConstraintProd Maybe Show f as => Show (PMaybe f as) 
Instance details

Defined in Data.Type.Functor.Product

Methods

showsPrec :: Int -> PMaybe f as -> ShowS #

show :: PMaybe f as -> String #

showList :: [PMaybe f as] -> ShowS #

(PureProdC Maybe Backprop as, PureProdC Maybe Regularize as) => Regularize (PMaybe TF as) Source # 
Instance details

Defined in Backprop.Learn.Regularize

fromPJust :: PMaybe f (Just a) -> f a Source #

type family (a :: Maybe Type) :#? (b :: Maybe Type) :: Maybe Type where ... infixr 1 Source #

Equations

Nothing :#? Nothing = Nothing 
Nothing :#? (Just b) = Just b 
(Just a) :#? Nothing = Just a 
(Just a) :#? (Just b) = Just (a :# b) 

splitTupMaybe :: forall f a b. (PureProd Maybe a, PureProd Maybe b) => (forall a' b'. (a ~ Just a', b ~ Just b') => f (a' :# b') -> (f a', f b')) -> PMaybe f (a :#? b) -> (PMaybe f a, PMaybe f b) Source #

tupMaybe :: forall f a b. (forall a' b'. (a ~ Just a', b ~ Just b') => f a' -> f b' -> f (a' :# b')) -> PMaybe f a -> PMaybe f b -> PMaybe f (a :#? b) Source #