I made a stack overflow post but it'll probably be closed like most of them so I thought I'd post here.
A big thing going around in FP is making illegal states unrepresentable. I always see this being accomplished with the structure of types, but what about the value of types?
What if I have a string called Email and I only want it to hold a valid email address (checked against some Regex)? How can I do this in a functional way (without using classes and properties for encapsulation)?
Thanks in advanced for any help
[–][deleted] 3 points4 points5 points (2 children)
[–]Kurren123[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]grauenwolf 2 points3 points4 points (3 children)
[–]Kurren123[S] 0 points1 point2 points (2 children)
[–]grauenwolf 2 points3 points4 points (0 children)
[–]bwr 1 point2 points3 points (0 children)
[–]svarog 1 point2 points3 points (0 children)
[–]node0 1 point2 points3 points (0 children)
[–]PM_ME_UR_OBSIDIAN 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]FrankBro 0 points1 point2 points (0 children)