Development code to avoid overwriting during maintenance

I have a code based lensthat expects a specific data structure:

makeLenses ''Pool
...
pool ^. objects ^? _head :: Maybe Object

This code assumes that:

objects ::
  Functor f =>
  ([Object] -> f [Object]) -> Pool -> f Pool

But I want to introduce new information into the structure, and the new lens will become:

objects ::
  Functor f =>
  ([DebugInfo Object] -> f [DebugInfo Object]) -> Pool -> f Pool

My goal is to avoid any changes to existing code, as if it were a complex maintenance project.

Since I use the library lens, I believe that a new module should be available that provides a "backported" objectslens, so I do not need to change the old code (except for import).

? - , -? . , , "" . ?

, , ?

+4
1

, objects . : , , ,

data Foo = Foo { foo :: String, bar :: Int }
fooDef = Foo "" 0

newFoo :: String -> Int -> Foo
newFoo f b= fooDef { foo = f, bar = b }

, Foo, fooDef. , , , . , ?

+1

All Articles