summaryrefslogtreecommitdiff
path: root/src/Mind.hs
blob: 45b90da5a4bd40b0b80a4da4bf9805b76ab81157 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Mind
  ( NeuronIndex (..)
  , getNeuronIndex

  , Edge (..)
  
  , Network (..)
  , createEmptyNetwork
  ) where

-- index different neuron types
data NeuronIndex = Input Int | Internal Int | Output Int deriving (Show, Eq)

getNeuronIndex :: NeuronIndex -> Int
getNeuronIndex (Input i)    = i
getNeuronIndex (Internal i) = i
getNeuronIndex (Output i)   = i

-- define incident edges
newtype Edge = Edge (NeuronIndex, Float) deriving (Show, Eq)

-- define networks
data Network = Network 
  { numInput :: Int
  , internalNeurons :: [[Edge]]
  , outputNeurons :: [[Edge]]
  } deriving (Show, Eq)

createEmptyNetwork :: Int -> Int -> Int -> Network
createEmptyNetwork i h o = Network i (replicate h []) (replicate o [])