[Haskell-beginners] Pattern Matching for record syntax

Jeon-Young Kang jykang22 at gmail.com
Thu Jan 7 22:43:19 UTC 2016


For pattern matching.. I implemented like this.

compareName a (Person name age)
        | (a == name) = age

but, I got stuck how to apply pattern matching for the two lists.
i.e., both names and persons are lists.

I really appreciate your advice..



On Thu, Jan 7, 2016 at 5:37 PM, Imants Cekusins <imantc at gmail.com> wrote:

> > filter is only applicable to list, not "record syntax".
>
> but [Person] is the input, isn't it?
>
> > Do I need functor for this??
>
> no need to define new functor instance to filter over a list of records.
>
> but you could use fmap over list, yes
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160107/1c76f0b0/attachment.html>


More information about the Beginners mailing list