I'm using esqueleto for making SQL queries, and I have one query which returns data with type (Value a, Value b, Value c). I want to extract (a, b, c) from it. I know that I can use pattern matching like that:
let (Value a, Value b, Value c) = queryResult But I'd like to avoid repeating Value for every tuple element. This is particularly annoying when the tuple has much more elements (like 10). Is there any way to simplify this? Is there a function which I could use like that:
let (a, b, c) = someFunction queryResult
Valueis anewtypebut the Hackage one has it as adata. If you're using the Github one (with it asnewtype), yoursomeFunctionis justcoercefromData.Coerce. It has the added benefit of having zero runtime cost as well.