I need some advice on how to return a list of chapter names that do not contain text blocks (Text) in their type list [Article]
data Article = Text String
| Section String [Article] deriving (Show)
myArticle :: Article
myArticle = Section "Document" [
Section "Introduction" [
Text "My intoduction",
Section "Notation" [Text "alpha beta gamma"]],
Section "Methods" [
Section "Functional Programming" [Text "FPR"],
Section "Logical Programming" [Text "LPR"]],
Section "Results" [Text "All is great"]]
names :: Article -> [String]
Expected output:
names myArticle = ["Document", "Methods"]
I tried the basic functions:
names :: Article -> [String]