Skip to content

Instantly share code, notes, and snippets.

@JPMoresmau
Created September 24, 2010 12:21
Show Gist options
  • Save JPMoresmau/595266 to your computer and use it in GitHub Desktop.
Save JPMoresmau/595266 to your computer and use it in GitHub Desktop.
type Value = Float
type Neuron= ([Value],Value)
type Network = ([Neuron],[Neuron])
class DeepSeq a where
deepSeq :: a -> a
deepSeq x=x `seq` x
instance DeepSeq Value
instance DeepSeq a => DeepSeq [a] where
deepSeq []=[]
deepSeq (x:xs)=deepSeq x `seq` deepSeq xs `seq` (x:xs)
instance DeepSeq Neuron where
deepSeq (vals,t)=
let v2=deepSeq vals
in v2 `seq` (v2,deepSeq t)
instance DeepSeq Network where
deepSeq (is,os)=
let is2=deepSeq is
os2=deepSeq os
in is2 `seq` os2 `seq` (is2, os2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment