[Haskell-beginners] How to add a "method" to a record
David McBride
toad3k at gmail.com
Wed Sep 10 18:16:02 UTC 2014
Is this what you are looking for?
data Foo pl = Foo {
label :: pl -> String,
payload :: pl
}
On Wed, Sep 10, 2014 at 2:06 PM, martin <martin.drautzburg at web.de> wrote:
> Hello all
>
> if I have a record like
>
> data Foo pl = Foo {
> label :: String,
> payload :: pl
> }
>
> how can I create a similar type where I can populate label so it is not a
> plain string, but a function which operates on
> payload? Something like
>
> label (Foo pl) = show pl
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140910/f29ce44d/attachment.html>
More information about the Beginners
mailing list