Skip to content

Commit

Permalink
Add RecordOf and FieldOf for homogeneous records
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyoung committed Aug 10, 2017
1 parent 5b70a6f commit 8b39b00
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Type/Data/Record.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Type.Data.Record
( class RecordOf
) where

import Type.Row (class RowToList, Cons, Nil, kind RowList)

class RecordOf record fieldType
instance recordOf
:: ( RowToList record fields
, FieldOf fields fieldType
)
=> RecordOf (Record record) fieldType

class FieldOf (rowList :: RowList) fieldType
instance fieldOfCons
:: (FieldOf tail fieldType)
=> FieldOf (Cons symbol fieldType tail) fieldType
instance fieldOfNil :: FieldOf Nil fieldType

0 comments on commit 8b39b00

Please sign in to comment.