Created
September 24, 2010 12:21
-
-
Save JPMoresmau/595266 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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