[Haskell-beginners] How do I give a type for this code?

Daniel Trstenjak daniel.trstenjak at gmail.com
Thu Oct 17 11:13:00 UTC 2013


Hi Todd,

the problem is, that 'model_of' tries to return different types: Model a, Model (a,a) and Model [a].

I think you have to use some kind of ADT also for the Model, like you already did for ModName.

Something like:

   data Model a = Model a
                | ProductModel (a,a)
                | PowerModel [a]
                ...


Greetings,
Daniel


More information about the Beginners mailing list