Skip to content

Patterns documentation#586

Draft
lpil wants to merge 12 commits intomainfrom
patterns
Draft

Patterns documentation#586
lpil wants to merge 12 commits intomainfrom
patterns

Conversation

@lpil
Copy link
Member

@lpil lpil commented Jan 4, 2026

No description provided.

Copy link
Contributor

@Papipo Papipo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the builder pattern as an alternative to the non-existing optional arguments would be an interesting addition. Emphasis on "optional arguments" because that's what newbies will look for.

@Papipo
Copy link
Contributor

Papipo commented Jan 19, 2026

Sorry, I have just realised this is a draft. I caught a typo so I hope it's still welcome 😅

@aschrijver
Copy link

I saw the "make invalid states impossible" as a TODO section, and dropping in FYI some resources I have in my stashed browser tabs. First one "On making impossible states impossible is by Rasmus Larsson specifically on Gleam, and the 2nd article "Making Impossible States Impossible: Type-Safe Domain Modeling with Functional Dependency Injection by Christian Ekrem relates to Elm and F#. For me the excellent video by Scott Wlaschin was the absolute eye-opener on the usefulness of this pattern.

Comment on lines +349 to +362
let likely_generated =
// In newer versions of squirrel this is always at the beginning of the
// file and it would be enough to check for this comment to establish if
// a file is generated or not...
string.contains(
content,
"> 🐿️ This module was generated automatically using",
)
// ...but in older versions that module comment is not present! So we
// need to check if there's any function generated by squirrel.
|| string.contains(
content,
"> 🐿️ This function was generated automatically using",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honoured to be part of the examples 💖

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who better? 💜

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

Successfully merging this pull request may close these issues.

4 participants