
18 Apr
2016
18 Apr
'16
6:45 p.m.
Hi, I'm running into a weird problem i've never had before. I want to define a datatype like: data Network = forall a. Layer a => Network [a] for which I have things that implement Layer, like data TypicalLayer = ... instance Layer TypicalLayer where ... with this, I want to be able to load a Network from a config file where Network can consist of different data types all implementing Layer. Is there a nice way to do this without making a data type that combines all of my layer types, something like: data LayerType = TypicalLayerType TypicalLayer | AnotherLayerType AnotherLayer ... deriving (Show,Read) Thanks for the help! Charlie Durham