Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Homogeneous and HomogeneousRowList for homogeneous rows #20

Merged
merged 8 commits into from
Dec 10, 2017
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think (Record record) is the right thing to do here (as opposed to just record) but it has the consequence of changing the type of a function beyond simply adding the type constraint.

For example, this:

foo :: forall a
     . Record a
    -> Record a

becomes:

foo :: forall a
     . RecordOf a Boolean
    => a
    -> a


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