[Haskell-beginners] Application of lookup function

Jeon-Young Kang jykang22 at gmail.com
Fri Dec 4 04:46:25 UTC 2015


Hi all.

I'd like to apply lookup function (Data.Map) for what I am working on.

Here is my code.

data Person = Person {personId :: Int, name = String}
data People = [Person]

data State = InMembership | NoMemebership

person1 = Person {1 = personId, "James" = name}
person2 = Person {2 = personId, "Tom" = name}

members = People [person1, person2]

class Belonging a where
      belonging :: a -> [a] -> Bool -> State

here is the problem...
I don't know how to get to know whether a person is belong to members.
I'd like to find it through a person's name.

Can you suggest any examples??

Sincerely,
Jeon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151203/873b7895/attachment.html>


More information about the Beginners mailing list