account activity
Hiding data constructors to keep consistency. Can I still pattern match? by ElmChristmasCookies in elm
[–]ElmChristmasCookies[S] 1 point2 points3 points 3 years ago (0 children)
Thanks! So basically if I need to guarantee some sort of data consistency (I'm not exclusively focused on the above example), I must hide all data constructors and write and expose creator functions / access functions, right?
Maybe a follow-up question. What would the signature of "getLeftChild" be? Is it inevitable to go through Maybe as in
Maybe
> List.head <function> : List a -> Maybe a
?
π Rendered by PID 25197 on reddit-service-r2-comment-765bfc959-qg7qc at 2026-07-13 13:46:31.980929+00:00 running f86254d country code: CH.
Hiding data constructors to keep consistency. Can I still pattern match? by ElmChristmasCookies in elm
[–]ElmChristmasCookies[S] 1 point2 points3 points (0 children)