[Haskell-cafe] Named field syntax

Ketil Malde ketil at malde.org
Fri Aug 29 09:40:42 EDT 2008


Maurí­cio <briqueabraque at yahoo.com> writes:

> However, this doesn't work:
>
> data Test = Test Integer {b::String}

> Is there some way to name only a single, or a few,
> of some data type fields?

data Test = Test Integer String

b :: Test -> String
b (Test i s) = s

:-)

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list