[Haskell-beginners] If I only had a brain

Amy de Buitléir amy at nualeargais.ie
Sun Dec 12 21:26:26 CET 2010


I have a class with some functions that have type signatures of the form

  (RandomGen g) => some parameter types -> RandT g (State [Neuron]) something

For example:

  stimulate :: (RandomGen g) => Int -> [Double] -> RandT g (State [Neuron]) ()

That "RandT g (State [Neuron])" is my implementation of a "brain", so
I'd like to call it that. I tried:

  data (RandomGen g) => Brain g a = RandT g (State [Neuron]) a

But I got this error:

    `State [Neuron]' is not applied to enough type arguments
    Expected kind `?', but `State [Neuron]' has kind `* -> *'
    In the type `State [Neuron]'
    In the definition of data constructor `RandT'
    In the data type declaration for `Brain'

Do I need higher ranked types or existential types in order to do
that? Or am I going about this the wrong way?

Thank you in advance,
Amy



More information about the Beginners mailing list