@@ -32,18 +32,20 @@ import Data.Singletons ( SingI )
3232import Data.Singletons.Prelude ( Head, Last )
3333import Data.Serialize
3434
35+import Data.Kind (Type)
36+
3537import Grenade.Core
3638import Grenade.Recurrent.Core.Layer
3739
3840-- | Witness type to say indicate we're building up with a normal feed
3941-- forward layer.
40−data FeedForward :: * -> *
42+data FeedForward :: Type -> Type
4143-- | Witness type to say indicate we're building up with a recurrent layer.
42−data Recurrent :: * -> *
44+data Recurrent :: Type -> Type
4345
4446-- | Type of a recurrent neural network.
4547--
46−-- The [*] type specifies the types of the layers.
48+-- The [Type] type specifies the types of the layers.
4749--
4850-- The [Shape] type specifies the shapes of data passed between the layers.
4951--
@@ -52,7 +54,7 @@ data Recurrent :: * -> *
5254--
5355-- Often, to make the definitions more concise, one will use a type alias
5456-- for these empty data types.
55−data RecurrentNetwork :: [*] -> [Shape] -> * where
57+data RecurrentNetwork :: [Type] -> [Shape] -> Type where
5658 RNil :: SingI i
5759 => RecurrentNetwork '[] '[i]
5860
@@ -71,7 +73,7 @@ infixr 5 :~@>
7173-- | Gradient of a network.
7274--
7375-- Parameterised on the layers of the network.
74−data RecurrentGradient :: [*] -> * where
76+data RecurrentGradient :: [Type] -> Type where
7577 RGNil :: RecurrentGradient '[]
7678
7779 (://>) :: UpdateLayer x
@@ -81,7 +83,7 @@ data RecurrentGradient :: [*] -> * where
8183
8284-- | Recurrent inputs (sideways shapes on an imaginary unrolled graph)
8385-- Parameterised on the layers of a Network.
84−data RecurrentInputs :: [*] -> * where
86+data RecurrentInputs :: [Type] -> Type where
8587 RINil :: RecurrentInputs '[]
8688
8789 (:~~+>) :: (UpdateLayer x, Fractional (RecurrentInputs xs))
@@ -95,7 +97,7 @@ data RecurrentInputs :: [*] -> * where
9597--
9698-- We index on the time step length as well, to ensure
9799-- that that all Tape lengths are the same.
98−data RecurrentTape :: [*] -> [Shape] -> * where
100+data RecurrentTape :: [Type] -> [Shape] -> Type where
99101 TRNil :: SingI i
100102 => RecurrentTape '[] '[i]
101103
@@ -204,7 +206,7 @@ instance (Show x, Show (RecurrentNetwork xs rs)) => Show (RecurrentNetwork (Recu
204206
205207-- | A network can easily be created by hand with (:~~>) and (:~@>), but an easy way to initialise a random
206208-- recurrent network and a set of random inputs for it is with the randomRecurrent.
207−class CreatableRecurrent (xs :: [*]) (ss :: [Shape]) where
209+class CreatableRecurrent (xs :: [Type]) (ss :: [Shape]) where
208210 -- | Create a network of the types requested
209211 randomRecurrent :: MonadRandom m => m (RecurrentNetwork xs ss)
210212