on master help sign in
Add test case from #62
commite93bf2c3ad008e58caf893f9ec8428c21b70ab3b authorCsongor Kiss <kiss.csongor.kiss@gmail.com> dateSat 1 Sep 2018, 20:47 (8 years ago) parent63b2f76
2 files changed+15−1
generic-lens.cabal+1−1 test/Test62.hs+14
generic-lens.cabal+1−1
@@ -97,7 +97,7 @@ test-suite generic-lens-test
9797 type: exitcode-stdio-1.0
9898 hs-source-dirs: test
9999 main-is: Spec.hs
100− other-modules: Util Test24 Test25 Test40
100+ other-modules: Util Test24 Test25 Test40 Test62
101101
102102 build-depends: base >= 4.9 && <= 5.0
103103 , generic-lens
test/Test62.hsnew file+14
@@ -0,0 +1,14 @@
1+{-# LANGUAGE DataKinds, DeriveGeneric, TypeApplications #-}
2+module Test62 (example) where
3+import Data.Generics.Product (field)
4+import Data.Generics.Internal.VL.Lens (set)
5+import GHC.Generics (Generic)
6+
7+data Foo a = Foo { bar :: Bar a } deriving Generic
8+data Bar a = Bar { x :: a, y :: a } deriving Generic
9+
10+example :: Foo ()
11+example =
12+ set (field @"bar" . field @"x") ()
13+ . set (field @"bar" . field @"y") ()
14+ $ Foo{ bar = Bar{ x = (), y = () } }