pietervdvn / Lang

Yet another programming language
1 stars 1 forks source link

Behaviour of autogenerated setter function with multiple constructors #101

Open pietervdvn opened 8 years ago

pietervdvn commented 8 years ago

Given type A = {X f:Int, Y}

What should the default implementation of setF be?

Either:

f : Int -> A -> A
i (X _) = X i
i Y      = Y

Or

f : Int -> A -> Maybe A
i (X _) = Just (X i)
_ _     = Nothing