
1 Dec
2009
1 Dec
'09
12:08 p.m.
Hi, I want to define a record say "Student". The 'C' equvivalent for the same could be struct Person { char name[10] int age } The closest I can find for doing such a thing in haskell appears to be data Person = Person{ name :: [char] age :: Int } I have not yet been able to find a suitable way to specify the constraint on the length of list(name in this case). So can someone let me know how we can impose this length constratint on the list and derive a new type. If standard haskell doesn't give this flexibility, are there any extensions in ghc to achieve the same. - Srikanth