[Haskell-beginners] Structural restrictions in type constructor

Martin Vlk martin at vlkk.cz
Mon Jun 22 10:49:05 UTC 2015


I would think that it is not possible to use types to constrain the
values of data. I.e. type signature can be only used to constraint
types, not values.

But I am a beginner myself, so see if someone more experienced can shed
light here.

Martin


Matt Williams:
> Dear All,
> 
> I wonder if/ how this is possible?
> 
> I have a constructor which takes 2 pairs of type t).
> 
> However, I want to ensure that the pairs are matched:
> 
> MyP = MyP (t, t) (t, t)
> 
> But where the first pair contains the same elements as the second, but
> reversed in order.
> 
> Any help much appreciated.
> 
> BW,
> Matt
> 
> 
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> 


More information about the Beginners mailing list