I have a "Block" type alias.
type alias Block = {x:Int, y:Int, color:String}
Is it possible to have default values for x, y and color? Example, I want x and y to be 0 by default and color to be "blue".
You can't have default values in the way you often can in imperative languages, but this isn't a problem because you can easily define a function that sets the desired defaults:
defaultBlock : Block
defaultBlock = { x = 0, y = 0, color = "blue" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With