Skip to content

Commit 8c2352b

Browse files
committed
update: nit nit
1 parent be3db29 commit 8c2352b

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

lambda-buffers-compiler/src/LambdaBuffers/Compiler/KindCheck.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import LambdaBuffers.Compiler.KindCheck.Inference (
3939
)
4040
import LambdaBuffers.Compiler.KindCheck.Inference qualified as I
4141
import LambdaBuffers.Compiler.KindCheck.Type (Type (App))
42-
import LambdaBuffers.Compiler.KindCheck.Type qualified as P
4342
import LambdaBuffers.Compiler.KindCheck.Variable (Variable (ForeignRef, LocalRef))
4443
import LambdaBuffers.Compiler.ProtoCompat (kind2ProtoKind)
4544
import LambdaBuffers.Compiler.ProtoCompat.Types qualified as P (

lambda-buffers-compiler/test/Test/Samples/Proto/Helpers.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ _TupleI x =
3939
, P.sourceInfo = sourceInfo'empty
4040
}
4141

42-
_Constructor :: P.ConstrName -> P.Product -> P.Constructor
42+
_Constructor :: Text -> P.Product -> P.Constructor
4343
_Constructor c f =
4444
P.Constructor
45-
{ P.constrName = c
45+
{ P.constrName = _ConstrName c
4646
, P.product = f
4747
}
4848

@@ -53,19 +53,19 @@ _ConstrName x =
5353
, P.sourceInfo = sourceInfo'empty
5454
}
5555

56-
_Sum :: [P.Constructor] -> P.TyBody
56+
_Sum :: [(Text, P.Product)] -> P.TyBody
5757
_Sum cs =
5858
P.SumI $
5959
P.Sum
60-
{ constructors = fromList cs
60+
{ constructors = fromList $ uncurry _Constructor <$> cs
6161
, sourceInfo = sourceInfo'empty
6262
}
6363

64-
_TyAbs :: [P.TyArg] -> P.TyBody -> P.TyAbs
64+
_TyAbs :: [(Text, P.KindType)] -> [(Text, P.Product)] -> P.TyAbs
6565
_TyAbs args body =
6666
P.TyAbs
67-
{ P.tyArgs = args
68-
, P.tyBody = body
67+
{ P.tyArgs = _TyArg <$> args
68+
, P.tyBody = _Sum body
6969
, sourceInfo = sourceInfo'empty
7070
}
7171

lambda-buffers-compiler/test/Test/Samples/Proto/TyDef.hs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ module Test.Samples.Proto.TyDef (tyDef'maybe, tyDef'incoherent) where
22

33
import LambdaBuffers.Compiler.ProtoCompat qualified as P
44
import Test.Samples.Proto.Helpers (
5-
_ConstrName,
6-
_Constructor,
7-
_Sum,
85
_TupleI,
96
_TyAbs,
10-
_TyArg,
117
_TyDef,
128
_TyRefILocal,
139
_TyVarI,
@@ -20,21 +16,21 @@ tyDef'maybe :: P.TyDef
2016
tyDef'maybe =
2117
_TyDef
2218
(_tyName "Maybe")
23-
( _TyAbs [_TyArg ("a", _Type)] $
24-
_Sum
25-
[ _Constructor (_ConstrName "Nothing") (_TupleI [])
26-
, _Constructor (_ConstrName "Just") (_TupleI [_TyVarI "a"])
27-
]
19+
( _TyAbs
20+
[("a", _Type)]
21+
[ ("Nothing", _TupleI [])
22+
, ("Just", _TupleI [_TyVarI "a"])
23+
]
2824
)
2925

3026
-- | B a = B Maybe
3127
tyDef'incoherent :: P.TyDef
3228
tyDef'incoherent =
3329
_TyDef
3430
(_tyName "B")
35-
( _TyAbs [_TyArg ("a", _Type)] $
36-
_Sum
37-
[ _Constructor (_ConstrName "Nothing") (_TupleI [])
38-
, _Constructor (_ConstrName "B") (_TupleI [_TyRefILocal "Maybe"])
39-
]
31+
( _TyAbs
32+
[("a", _Type)]
33+
[ ("Nothing", _TupleI [])
34+
, ("B", _TupleI [_TyRefILocal "Maybe"])
35+
]
4036
)

0 commit comments

Comments
 (0)