DeepDarkFantasy-0.2017.8.4: A DSL for creating neural network.

Safe HaskellSafe
LanguageHaskell2010

DDF.DBI

Documentation

class Monoid r m where Source #

Minimal complete definition

zero, plus

Methods

zero :: r h m Source #

plus :: r h (m -> m -> m) Source #

class DBI r where Source #

Minimal complete definition

z, s, abs, app

Methods

z :: r (a, h) a Source #

s :: r h b -> r (a, h) b Source #

abs :: r (a, h) b -> r h (a -> b) Source #

app :: r h (a -> b) -> r h a -> r h b Source #

hoas :: (r (a, h) a -> r (a, h) b) -> r h (a -> b) Source #

We use a variant of HOAS so it can be compile to DBI, which is more compositional (No Negative Occurence). It require explicit lifting of variables. Use lam to do automatic lifting of variables.

com :: r h ((b -> c) -> (a -> b) -> a -> c) Source #

flip :: r h ((a -> b -> c) -> b -> a -> c) Source #

id :: r h (a -> a) Source #

const :: r h (a -> b -> a) Source #

scomb :: r h ((a -> b -> c) -> (a -> b) -> a -> c) Source #

dup :: r h ((a -> a -> b) -> a -> b) Source #

let_ :: r h (a -> (a -> b) -> b) Source #

Instances

DBI Show Source # 

Methods

z :: Show (a, h) a Source #

s :: Show h b -> Show (a, h) b Source #

abs :: Show (a, h) b -> Show h (a -> b) Source #

app :: Show h (a -> b) -> Show h a -> Show h b Source #

hoas :: (Show (a, h) a -> Show (a, h) b) -> Show h (a -> b) Source #

com :: Show h ((b -> c) -> (a -> b) -> a -> c) Source #

flip :: Show h ((a -> b -> c) -> b -> a -> c) Source #

id :: Show h (a -> a) Source #

const :: Show h (a -> b -> a) Source #

scomb :: Show h ((a -> b -> c) -> (a -> b) -> a -> c) Source #

dup :: Show h ((a -> a -> b) -> a -> b) Source #

let_ :: Show h (a -> (a -> b) -> b) Source #

DBI Size Source # 

Methods

z :: Size (a, h) a Source #

s :: Size h b -> Size (a, h) b Source #

abs :: Size (a, h) b -> Size h (a -> b) Source #

app :: Size h (a -> b) -> Size h a -> Size h b Source #

hoas :: (Size (a, h) a -> Size (a, h) b) -> Size h (a -> b) Source #

com :: Size h ((b -> c) -> (a -> b) -> a -> c) Source #

flip :: Size h ((a -> b -> c) -> b -> a -> c) Source #

id :: Size h (a -> a) Source #

const :: Size h (a -> b -> a) Source #

scomb :: Size h ((a -> b -> c) -> (a -> b) -> a -> c) Source #

dup :: Size h ((a -> a -> b) -> a -> b) Source #

let_ :: Size h (a -> (a -> b) -> b) Source #

DBI UInt Source # 

Methods

z :: UInt (a, h) a Source #

s :: UInt h b -> UInt (a, h) b Source #

abs :: UInt (a, h) b -> UInt h (a -> b) Source #

app :: UInt h (a -> b) -> UInt h a -> UInt h b Source #

hoas :: (UInt (a, h) a -> UInt (a, h) b) -> UInt h (a -> b) Source #

com :: UInt h ((b -> c) -> (a -> b) -> a -> c) Source #

flip :: UInt h ((a -> b -> c) -> b -> a -> c) Source #

id :: UInt h (a -> a) Source #

const :: UInt h (a -> b -> a) Source #

scomb :: UInt h ((a -> b -> c) -> (a -> b) -> a -> c) Source #

dup :: UInt h ((a -> a -> b) -> a -> b) Source #

let_ :: UInt h (a -> (a -> b) -> b) Source #

DBI r => DBI (P r) Source # 

Methods

z :: P r (a, h) a Source #

s :: P r h b -> P r (a, h) b Source #

abs :: P r (a, h) b -> P r h (a -> b) Source #

app :: P r h (a -> b) -> P r h a -> P r h b Source #

hoas :: (P r (a, h) a -> P r (a, h) b) -> P r h (a -> b) Source #

com :: P r h ((b -> c) -> (a -> b) -> a -> c) Source #

flip :: P r h ((a -> b -> c) -> b -> a -> c) Source #

id :: P r h (a -> a) Source #

const :: P r h (a -> b -> a) Source #

scomb :: P r h ((a -> b -> c) -> (a -> b) -> a -> c) Source #

dup :: P r h ((a -> a -> b) -> a -> b) Source #

let_ :: P r h (a -> (a -> b) -> b) Source #

Prod r => DBI (UnLiftEnv r) Source # 

Methods

z :: UnLiftEnv r (a, h) a Source #

s :: UnLiftEnv r h b -> UnLiftEnv r (a, h) b Source #

abs :: UnLiftEnv r (a, h) b -> UnLiftEnv r h (a -> b) Source #

app :: UnLiftEnv r h (a -> b) -> UnLiftEnv r h a -> UnLiftEnv r h b Source #

hoas :: (UnLiftEnv r (a, h) a -> UnLiftEnv r (a, h) b) -> UnLiftEnv r h (a -> b) Source #

com :: UnLiftEnv r h ((b -> c) -> (a -> b) -> a -> c) Source #

flip :: UnLiftEnv r h ((a -> b -> c) -> b -> a -> c) Source #

id :: UnLiftEnv r h (a -> a) Source #

const :: UnLiftEnv r h (a -> b -> a) Source #

scomb :: UnLiftEnv r h ((a -> b -> c) -> (a -> b) -> a -> c) Source #

dup :: UnLiftEnv r h ((a -> a -> b) -> a -> b) Source #

let_ :: UnLiftEnv r h (a -> (a -> b) -> b) Source #

class LiftEnv r where Source #

Minimal complete definition

liftEnv

Methods

liftEnv :: r () a -> r h a Source #

const1 :: DBI r => r h a -> r h (b -> a) Source #

map2 :: Functor r f => r h (a -> b) -> r h (f a) -> r h (f b) Source #

return :: Applicative r a => r h (x -> a x) Source #

bind2 :: Monad r m => r h (m a) -> r h (a -> m b) -> r h (m b) Source #

map1 :: Functor r f => r h (a -> b) -> r h (f a -> f b) Source #

join1 :: Monad r m => r h (m (m a)) -> r h (m a) Source #

bimap2 :: (BiFunctor * r p, DBI r) => r h (a -> b) -> r h (c -> d) -> r h (p a c -> p b d) Source #

bimap3 :: (BiFunctor * r p, DBI r) => r h (a -> b) -> r h (c -> d) -> r h (p a c) -> r h (p b d) Source #

flip1 :: DBI r => r h (a -> b -> c) -> r h (b -> a -> c) Source #

flip2 :: DBI r => r h (a1 -> a -> c) -> r h a -> r h (a1 -> c) Source #

let_2 :: DBI r => r h a -> r h (a -> b) -> r h b Source #

class DBI r => Functor r f where Source #

Minimal complete definition

map

Methods

map :: r h ((a -> b) -> f a -> f b) Source #

Instances

Functor Show x Source # 

Methods

map :: Show h ((a -> b) -> x a -> x b) Source #

Functor Size x Source # 

Methods

map :: Size h ((a -> b) -> x a -> x b) Source #

Functor UInt x Source # 

Methods

map :: UInt h ((a -> b) -> x a -> x b) Source #

(Prod r, Functor r m) => Functor (UnLiftEnv r) m Source # 

Methods

map :: UnLiftEnv r h ((a -> b) -> m a -> m b) Source #

class Functor r a => Applicative r a where Source #

Minimal complete definition

pure, ap

Methods

pure :: r h (x -> a x) Source #

ap :: r h (a (x -> y) -> a x -> a y) Source #

Instances

Applicative Show x Source # 

Methods

pure :: Show h (x -> x x) Source #

ap :: Show h (x (x -> y) -> x x -> x y) Source #

Applicative Size x Source # 

Methods

pure :: Size h (x -> x x) Source #

ap :: Size h (x (x -> y) -> x x -> x y) Source #

Applicative UInt x Source # 

Methods

pure :: UInt h (x -> x x) Source #

ap :: UInt h (x (x -> y) -> x x -> x y) Source #

(Prod r, Applicative r m) => Applicative (UnLiftEnv r) m Source # 

Methods

pure :: UnLiftEnv r h (x -> m x) Source #

ap :: UnLiftEnv r h (m (x -> y) -> m x -> m y) Source #

class Applicative r m => Monad r m where Source #

Minimal complete definition

join | bind

Methods

bind :: r h (m a -> (a -> m b) -> m b) Source #

join :: r h (m (m a) -> m a) Source #

Instances

Monad Show x Source # 

Methods

bind :: Show h (x a -> (a -> x b) -> x b) Source #

join :: Show h (x (x a) -> x a) Source #

Monad Size x Source # 

Methods

bind :: Size h (x a -> (a -> x b) -> x b) Source #

join :: Size h (x (x a) -> x a) Source #

Monad UInt x Source # 

Methods

bind :: UInt h (x a -> (a -> x b) -> x b) Source #

join :: UInt h (x (x a) -> x a) Source #

(Prod r, Monad r m) => Monad (UnLiftEnv r) m Source # 

Methods

bind :: UnLiftEnv r h (m a -> (a -> m b) -> m b) Source #

join :: UnLiftEnv r h (m (m a) -> m a) Source #

class BiFunctor r p where Source #

Minimal complete definition

bimap

Methods

bimap :: r h ((a -> b) -> (c -> d) -> p a c -> p b d) Source #

com2 :: DBI r => r h (b -> c) -> r h (a -> b) -> r h (a -> c) Source #

class NT repr l r where Source #

Minimal complete definition

conv

Methods

conv :: repr l t -> repr r t Source #

Instances

NT k k1 repr x x Source # 

Methods

conv :: x l t -> x r t Source #

NTS k k1 repr l r => NT k k1 repr l r Source # 

Methods

conv :: r l t -> r r t Source #

class NTS repr l r where Source #

Minimal complete definition

convS

Methods

convS :: repr l t -> repr r t Source #

Instances

(DBI repr, NT * * repr l r) => NTS * * repr l (a, r) Source # 

Methods

convS :: (a, r) l t -> (a, r) r t Source #

lam :: forall repr a b h. DBI repr => ((forall k. NT repr (a, h) k => repr k a) -> repr (a, h) b) -> repr h (a -> b) Source #

lam2 :: forall repr a b c h. DBI repr => ((forall k. NT repr (a, h) k => repr k a) -> (forall k. NT repr (b, (a, h)) k => repr k b) -> repr (b, (a, h)) c) -> repr h (a -> b -> c) Source #

lam3 :: (NT * * repr (a, (b1, (a1, h))) k, NT * * repr (b1, (a1, h)) k1, NT * * repr (a1, h) k2, DBI repr) => (repr k2 a1 -> repr k1 b1 -> repr k a -> repr (a, (b1, (a1, h))) b) -> repr h (a1 -> b1 -> a -> b) Source #

lam4 :: (NT * * repr (a, (a1, (b1, (a2, h)))) k, NT * * repr (a2, h) k3, NT * * repr (b1, (a2, h)) k2, NT * * repr (a1, (b1, (a2, h))) k1, DBI repr) => (repr k3 a2 -> repr k2 b1 -> repr k1 a1 -> repr k a -> repr (a, (a1, (b1, (a2, h)))) b) -> repr h (a2 -> b1 -> a1 -> a -> b) Source #

app2 :: DBI r => r h (a1 -> a -> b) -> r h a1 -> r h a -> r h b Source #

app3 :: DBI r => r h (a2 -> a1 -> a -> b) -> r h a2 -> r h a1 -> r h a -> r h b Source #

app4 :: DBI r => r h (a3 -> a2 -> a1 -> a -> b) -> r h a3 -> r h a2 -> r h a1 -> r h a -> r h b Source #

app5 :: DBI r => r h (a4 -> a3 -> a2 -> a1 -> a -> b) -> r h a4 -> r h a3 -> r h a2 -> r h a1 -> r h a -> r h b Source #

plus2 :: (Monoid * r b, DBI r) => r h b -> r h b -> r h b Source #

noEnv :: repr () x -> repr () x Source #

scomb2 :: DBI r => r h (a -> b -> c) -> r h (a -> b) -> r h (a -> c) Source #

plus1 :: (Monoid * r a, DBI r) => r h a -> r h (a -> a) Source #

dup1 :: DBI r => r h (a -> a -> b) -> r h (a -> b) Source #