-
Notifications
You must be signed in to change notification settings - Fork 21
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
paf31
merged 8 commits into
purescript:master
from
paulyoung:paulyoung/homogeneous-records
Dec 10, 2017
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8b39b00
Add RecordOf and FieldOf for homogeneous records
paulyoung 17d4228
Rename to `Homogenous` and move to `Row` type
paulyoung 0d25ad4
Add comment explaining Homogeneous class
paulyoung 3d51ac4
Add missin fun dep
paulyoung 6d179f8
Add Type.Row.Homogeneous
paulyoung 20fdbe6
Remove unwanted comment
paulyoung fe087b6
Rename `FieldOf` to `HomogenousRowList`
paulyoung 632538d
Rename instances to coincide previous renaming
paulyoung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 justrecord
) but it has the consequence of changing the type of a function beyond simply adding the type constraint.For example, this:
becomes: