Can I create a new recording using lenses?

If I have a recording type with lenses, is it possible to create a new recording without using basic recordings?

{-# LANGUAGE TemplateHaskell #-} import Control.Lens import Control.Lens.TH data Foo = Foo { _s :: String , _b :: Bool } deriving (Show, Eq) makeLenses ''Foo 

I could make Foo instance of Data.Default and then modifiy def with lenses, but not all record types will have reasonable defaults. Does Control.Lens have its own way of doing this?

+8
haskell lenses
source share
1 answer

No, there is currently no way to do this. You will have to use something like Foo{} by default or not use the lens for recording. However, the lens already has an issue .

+6
source share

All Articles