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 support for records of records of types #700

Merged
merged 2 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions dhall/src/Dhall/TypeCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,7 @@ typeWithA tpa = loop
Left (TypeError ctx e (InvalidFieldType k t))
Dhall.Map.traverseWithKey_ process rest

case c of
Type -> return (Const Type)
Kind -> return (Const Sort)
Sort -> return (Const Sort)
return (Const c)
loop ctx e@(RecordLit kvs ) = do
case Dhall.Map.toList kvs of
[] -> return (Record mempty)
Expand Down
6 changes: 3 additions & 3 deletions dhall/tests/TypeCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ typecheckTests =
, should
"allow records of types of mixed kinds"
"success/recordOfTypes"
, should
"allow Boehm-Berarducci-encoded records of types of mixed kinds"
"success/encodedRecordOfTypes"
, should
"allow accessing a type from a record"
"success/accessType"
Expand All @@ -62,6 +59,9 @@ typecheckTests =
, should
"allow accessing a constructor from a type stored inside a record"
"success/simple/mixedFieldAccess"
, should
"allow a record of a record of types"
"success/recordOfRecordOfTypes"
]

preludeExamples :: TestTree
Expand Down
3 changes: 0 additions & 3 deletions dhall/tests/typecheck/success/encodedRecordOfTypesA.dhall

This file was deleted.

1 change: 0 additions & 1 deletion dhall/tests/typecheck/success/encodedRecordOfTypesB.dhall

This file was deleted.

3 changes: 3 additions & 0 deletions dhall/tests/typecheck/success/recordOfRecordOfTypesA.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let types = { Scopes = < Public : {} | Private : {} >}
let prelude = { types = types }
in prelude.types.Scopes.Public {=}
1 change: 1 addition & 0 deletions dhall/tests/typecheck/success/recordOfRecordOfTypesB.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
< Public : {} | Private : {} >