on master help sign in
Exports
commita5b7e74d9c37c37c488281d3f612723fdda774ad authorCsongor Kiss <kiss.csongor.kiss@gmail.com> dateSat 10 Jun 2017, 17:20 (9 years ago) parent984c8db
4 files changed+33−1
examples/StarWars.hs+1 generic-lens.cabal+3−1 src/Data/Generics/Product.hs+28 src/Data/Generics/Record.hs+1
examples/StarWars.hs+1
@@ -11,6 +11,7 @@ module StarWars where
1111
1212import GHC.Generics
1313import Data.Generics.Record
14+import Data.Generics.Product
1415
1516data Episode = NEWHOPE | EMPIRE | JEDI
1617 deriving (Generic, Show, Eq)
generic-lens.cabal+3−1
@@ -1,6 +1,6 @@
11name: generic-lens
22
3−version: 0.2.0.0
3+version: 0.1.0.0
44
55synopsis: Generic data-structure operations exposed as lenses.
66
@@ -23,6 +23,7 @@ build-type: Simple
2323-- Extra files to be distributed with the package, such as examples or a
2424-- README.
2525extra-source-files: ChangeLog.md
26+ , examples/StarWars.hs
2627
2728-- Constraint on the version of Cabal needed to build this package.
2829cabal-version: >= 1.10
@@ -30,6 +31,7 @@ cabal-version: >= 1.10
3031
3132library
3233 exposed-modules: Data.Generics.Record
34+ , Data.Generics.Product
3335 , Data.Generics.Record.Subtype
3436 , Data.Generics.Record.HasField
3537 , Data.Generics.Product.HasFieldAt
src/Data/Generics/Product.hsnew file+28
@@ -0,0 +1,28 @@
1+-----------------------------------------------------------------------------
2+-- |
3+-- Module : Data.Generics.Record
4+-- Copyright : (C) 2017 Csongor Kiss
5+-- License : BSD3
6+-- Maintainer : Csongor Kiss <kiss.csongor.kiss@gmail.com>
7+-- Stability : experimental
8+-- Portability : non-portable
9+--
10+-- Magic product operations using Generics
11+--
12+-- These classes need not be instantiated manually, as GHC can automatically
13+-- prove valid instances via Generics. Only the `Generic` class needs to
14+-- be derived (see examples).
15+--
16+-----------------------------------------------------------------------------
17+module Data.Generics.Product
18+ (
19+ -- * Magic lens
20+ HasFieldAt (..)
21+
22+ -- * Getter and setter
23+ , getFieldAt
24+ , setFieldAt
25+
26+ ) where
27+
28+import Data.Generics.Product.HasFieldAt
src/Data/Generics/Record.hs+1
@@ -18,6 +18,7 @@ module Data.Generics.Record
1818 (
1919 -- * Subtype relationship
2020 Subtype (..)
21+ , subtype
2122
2223 -- * Magic lens
2324 , HasField (..)