How do I make lenses from a record in GHCi
问题 I want to play around with the Lens library a bit. I've loaded it into GHCi and created a record data type with the appropriate underscores: > data Foo a = Foo {_arg1 :: Int, _arg2 :: [a]} I would like to make the lenses for Foo using the makeLenses template. I would like to do this without needing to read through the entire set of Template-Haskell docs. What incantation can I type in at the GHCi prompt to get this to work? 回答1: Tested in GHCi 7.8.3: :set -XTemplateHaskell :m +Control.Lens :{