I have a haskell template that looks something like this:
data Configuration { confA :: Integer , confB :: Boolean , confC :: String } x = (\arg opt -> opt{ confA=arg }) y = (\arg opt -> opt{ confB=arg }) z = (\arg opt -> opt{ confC=arg })
and I would like to remove the template so that something gives in the following lines:
setter :: (Config -> a) -> a -> Config -> Config x = setter confA y = setter confB z = setter confC
But I have no idea how to build such a setter function. Is this possible in (without a template) haskell, or am I against using the sugar syntax here? If so, how can I do such a thing in a haskell template?
source share