lue-bird / elm-no-record-type-alias-constructor-function / RecordWithoutConstructorFunction

trick: no record type alias constructor function


type alias RecordWithoutConstructorFunction record =
record

Every directly aliased record type gets its default constructor function:

type alias Point =
    { x : Float, y : Float }

Point 4 2
--> { x = 4, y = 2 }

you can avoid this by using

type alias Record =
    RecordWithoutConstructorFunction
        { yourCurrentRecord }

why

Automatic record constructor functions come with countless problems:

tips