Declare the parameters of typed builders nominal
> The parameters to `Builder` and `NamedBuilder` in `Data.Csv.Incremental` are phantom, so GHC infers the same for their roles. This allows them to be `coerce`d willy nilly, defeating their purpose of using the type system to avoid building malformed CSV.
>
> Declaring the parameters `nominal` fixes this issue by ensuring that a given builder uses the same record construction instance throughout.
It's also good practice to give such phantoms explicit kind signatures to avoid troubles due to accidental kind polymorphism. It doesn't look like the module is using `PolyKinds` at this time, but it's the sort of extension that really should be on by default, so I've added the signatures anyway—consider it future proofing.
合并状态:未合并 4 条评论