I’m using large-anon
sporadically in a newish production codebase. Nothing super compelling yet. It’s straightforward to use and has neat syntax. I’ve used it for some toJSON
instances where instead of importing Data.Aeson
's object
and .=
(the latter especially is being a name that clashes with many libs including lens/optics) you can just use record syntax. Like
instance ToJSON MyError where
toJSON (MyError (FailureResponse req resp)) = toJSON ANON
{ request = ANON
{ httpVersion = Text.decodeUtf8Lenient req.requestHttpVersion
, method = Text.decodeUtf8Lenient req.requestMethod
, path = Text.decodeUtf8Lenient req.requestPath
}
, response = ...
}
But I think where it would be a much more tangible benefit is if SQL libraries like beam/opaleye/hasql-th adopted it for return and parameter types. It’s fairly cumbersome defining new types for every new query, or using tuples. Squeal-postgresql has a lot of integration with generics-sop which is nice but when I used it last had a pretty big compilation time penalty.