https://slides.com/emhoracek/haskell-24/live
1. A project
2. How we did it
3. Challenges
4. Strategies that helped
WordPress with Haskell app embedded in iFrames
Haskell app
WordPress
Haskell app
Haskell app serves content from WordPress API
Haskell app
WordPress
https://slides.com/emhoracek/haskell/live
"acf": {
"internal_memo": "",
"sections": [
{
"acf_fc_layout": "standard",
"title": "(section title)",
"featured_media": false,
"section": [
{
"content": "(section content)"
}
]
}
],
"paywall": false,
"toc": false,
"subhead": "(subhead)",
"antescript": "",
"postscript": "",
"footnotes": ""
/* and many more */
}
<wpPostByPermalink>
<apply template="_post">
<wpMultisection>
<wpSections>
<wpSection>
<section class="po-cn__section po-wp__section" id="ch-${wpSectionsIndex}">
<if exists="${wpTitle}">
<then><h1 class="po-cn__subhead po-wp__subhead"><wpTitle/></h1></then>
<else><hr class="po-cn__rule po-wp__rule"/></else>
</if>
<wpContent/>
</section>
</wpSection>
</wpSections>
</wpMultisection>
</apply>
</wpPostByPermalink>
multiSectionFields :: Field Ctxt
multiSectionFields = CN "multisection"
["acf"]
[ M "sections"
[ F "title"
, M "section"
[ F "content" ] ] ]
data Field s = F Text -- A single flat text or number field
| P Text (Text -> Fill s) -- A custom-parsed flat field
| N Text [Field s] -- A nested object field
| C Text [Text] -- A text field found by following the specified path
| CN Text [Text] [Field s] -- Combination of `C` and `N`
| M Text [Field s] -- A list field, where each element is an object
data Field s = F Text -- A single flat text or number field
| N Text [Field s] -- A nested object field
| C Text [Text] -- A nested text field found by following the specified path
| CN Text [Text] [Field s] -- Combination of `C` and `N`
| M Text [Field s] -- A list field, where each element is an object
| P Text (Text -> Fill s) -- A custom-parsed flat text field
| B Text -- A single flat boolean field
| CB Text [Text] -- Combination of `C` and `B`
| PV Text (Maybe Value -> Fill s) -- A custom-parsed value field
| PN Text (Object -> Fill s) -- A custom-parsed nested field
| PM Text ([Object] -> Fill s) -- A custom-parsed list field
| Q Text IdToEndpoint -- A field that will make another request
| QM Text IdsToEndpoint -- A list of fields that will make another request
https://slides.com/emhoracek/haskell-24/live
Me: "How have your teams handled stuff like this?"
David: "The templating languages are more flexible than Larceny, and the frameworks make it easier to expose more data."
Me: "Oh. We can do that."
David: "We can?!"
We write wpCustom, which allows Remeike to query any endpoint he wants and use any JSON from the response!
<wpCustom endpoint="wp/v2/posts/${wpId}">
<ul>
<wpTags>
<li><a href="/tag/${wpSlug}"><wpName/></a></li>
</wpTags>
</ul>
</wpCustom>
{ id: 43453,
/* ...lots of other fields... */
tags: [
{ name: "Sports", slug: "sports"
name: "Bookmarx", slug: "bookmarx" }
]
}
A few weeks later,
a wpCustom template
crashes the entire site.
https://slides.com/emhoracek/haskell-24/live
According to my research the fence was built as an art project and abandoned in 1975!
THERE WAS A RAMPAGING BULL BEHIND THE FENCE
idk what if it's important?????
who knows????
I'll research the historical owners of the surrounding property.
https://slides.com/emhoracek/haskell-24/live
https://slides.com/emhoracek/haskell-24/live
Can't find a person with extensive production experience developing FP web applications? Try:
a person with knowledge of FP
plus
a person with experience in web applications
It works!