| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Fri, 16 Jan 2026 23:49:53 GMT
X-Served-By: cache-dfw-kdfw8210072-DFW, cache-bom-vanm7210034-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768607393.776167,VS0,VE295
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
extend-record-data-th: TH to define a new record data type that extends the existing record data type.
[Skip to Readme]
extend-record-data-th: TH to define a new record data type that extends the existing record data type.
Please see the README on GitHub at https://github.com/nakaji-dayo/extend-record-data-th#readme
[Skip to Readme]
Downloads
- extend-record-data-th-0.1.0.2.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.0.0, 0.1.0.1, 0.1.0.2 |
|---|---|
| Change log | ChangeLog.md |
| Dependencies | attoparsec, base (>=4.7 && <5), template-haskell, text [details] |
| License | BSD-3-Clause |
| Copyright | 2019 Daishi Nakajima |
| Author | Daishi Nakajima |
| Maintainer | nakaji.dayo@gmail.com |
| Uploaded | by nakaji_dayo at 2019-07-07T06:38:29Z |
| Category | Data |
| Home page | https://github.com/nakaji-dayo/extend-record-data-th#readme |
| Bug tracker | https://github.com/nakaji-dayo/extend-record-data-th/issues |
| Source repo | head: git clone https://github.com/nakaji-dayo/extend-record-data-th |
| Distributions | NixOS:0.1.0.2 |
| Downloads | 1424 total (10 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2019-07-07 [all 1 reports] |
Readme for extend-record-data-th-0.1.0.2
[back to package description]data-extend-th
TH to define a new record data type that extends the existing simple record data type.
This library should be useful when used with generic-lens.
Syntax
$(extendD "data T = T1 <> T2 <> { f1 :: T3, f2 :: T4 } deriving (c1, c2) ")
Examples
unioning existing record data type
data Animal = Animal
{ name :: String
, age :: Int
} deriving (Show, Eq, Generic)
data HumanInfo = HumanInfo
{ address :: String
} deriving (Show, Eq, Generic)
$(extendD "data Human = Animal <> HumanInfo deriving (Show, Generic) ")
data Human
:i Human
data Human
= Human {name :: String,
age :: Int,
address :: String}
instance Show Human
instance Generic Human
higher kind, define field records anonymously
data X a = X {f1 :: a Int} deriving (Generic)
data Y a = Y {f2 :: Maybe a} deriving (Generic, Show)
data Z a = Z { x :: X a } deriving(Generic)
$(extendD "data XY = X <> Y <> { e1 :: String, e2 :: String } <> Z deriving (Generic)")
XY
data XY (a :: * -> *) a1 (a2 :: * -> *)
= XY {f1 :: a Int,
f2 :: Maybe a1,
e1 :: String,
e2 :: String,
x :: X a2}
instance Generic (XY a1 a2 a3)