Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data Student = Student {studentName::String, studentSurname::String, age::Int, index::String}
- data Teacher = Teacher {teacherName::String, teacherSurname::String, phone::String}
- getName::Student->String
- getName student = studentName student
- setName::Student->String->Student
- setName student name = Student firstName surname (age student) (index student)
- where
- firstName = splitted !! 0
- surname = splitted !! 1
- splitted = words name
- instance Show Student where
- show student = studentName student ++ " " ++ studentSurname student ++ " " ++ show (age student) ++ " " ++ index student
- instance Eq Student where
- (==) student1 student2 = (studentName student1 == studentName student2) && (studentSurname student1 == studentSurname student2) && (age student1 == age student2) && (index student1 == index student2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement