[Haskell-beginners] Question on data/type

David Virebayre dav.vire+haskell at gmail.com
Tue Nov 17 04:56:15 EST 2009


On Mon, Nov 16, 2009 at 7:17 PM, Brent Yorgey <byorgey at seas.upenn.edu>
wrote:

> On Mon, Nov 16, 2009 at 12:33:51AM -0500, Phillip Pirrip wrote:

>> The alternative I guess is to use 3 different type constructors,

>> data TypeConA a = ValConA a
>> data TypeConB a = ValConB [ValConA a]
>> data TypeConC a = ValConC [ValConB a]

>> but then I can't use one signal typeclass for (+) etc.  Am I correct?

> Yes, this seems like the correct alternative to me.  What is so bad

With a minor correction :

data TypeConA a = ValConA a
data TypeConB a = ValConB [TypeConA a]
data TypeConC a = ValConC [TypeConB a]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20091117/987ab093/attachment.html


More information about the Beginners mailing list