Stream: platform development

Topic: Phantom builder pattern


view this post on Zulip Wolfgang Schuster (Oct 17 2021 at 02:11):

I've been trying to understand how to build something like https://medium.com/carwow-product-engineering/phantom-builder-pattern-in-elm-2fcb950a4e36 in Roc and really struggling. I feel like

init : WindowConfig [ CanAddTitle ]*
init = @WindowConfig [] [ CanAddTitle ]


WindowConfig a : [ @WindowConfig (List (List Str)) a ]


withTitle : WindowConfig [ CanAddTitle ]*, Str -> WindowConfig *
withTitle = \@WindowConfig options a, title -> @WindowConfig (List.append options [ "with_title", title ]) a

is the Roc equivalent but I'm not understanding the error messages. Any suggestions?


Last updated: Jul 05 2025 at 12:14 UTC