Skip to content

Commit 8b39b00

Browse files
committed
Add RecordOf and FieldOf for homogeneous records
1 parent 5b70a6f commit 8b39b00

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Type/Data/Record.purs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module Type.Data.Record
2+
( class RecordOf
3+
) where
4+
5+
import Type.Row (class RowToList, Cons, Nil, kind RowList)
6+
7+
class RecordOf record fieldType
8+
instance recordOf
9+
:: ( RowToList record fields
10+
, FieldOf fields fieldType
11+
)
12+
=> RecordOf (Record record) fieldType
13+
14+
class FieldOf (rowList :: RowList) fieldType
15+
instance fieldOfCons
16+
:: (FieldOf tail fieldType)
17+
=> FieldOf (Cons symbol fieldType tail) fieldType
18+
instance fieldOfNil :: FieldOf Nil fieldType

0 commit comments

Comments
 (0)