I have a Person record with a name and an id, and a function createPerson that returns a Person without id, leaving generating the UUID to the caller.:
-- Person.hs
import Data.UUID (UUID)
data Person = Person { name :: String, id :: UUID }
createPerson name = Person { name = name }
Is there a way type a Person without an id, to inform the Caller that id Person will throw an exception? I've considered defining a PartialPerson as follows:
data PartialPerson = { name :: String }
but this quickly gets cumbersome when I want to add or change fields.