Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding HTML content in a record type #9

Open
dpk opened this issue Mar 17, 2023 · 0 comments
Open

Embedding HTML content in a record type #9

dpk opened this issue Mar 17, 2023 · 0 comments

Comments

@dpk
Copy link

dpk commented Mar 17, 2023

I’m a fairly new Haskeller and I can’t see how I can put HTML content from this package as a member field in a record type. The rule suggested in the readme is ‘don’t write the types’, but in this context it seems unavoidable.

Specifically I want to have a record type like

data BlogPost = { blogPostTitle :: String, blogPostContents :: TheTypeICan'tFind }

and write functions that run on it like

blogPostHtmlPage blogPost =
  Article :@ (ClassA := "post") :>
   ((H1 :> (blogPostTitle blogPost)) # (blogPostContents blogPost))

I realize this implies that TheTypeICan'tFind tells something about the content category allowed for blogPostContents, which is fine, but I can’t see how to specify that either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant