File tree Expand file tree Collapse file tree 3 files changed +17
-22
lines changed
src/LambdaBuffers/Compiler Expand file tree Collapse file tree 3 files changed +17
-22
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ import LambdaBuffers.Compiler.KindCheck.Inference (
3939 )
4040import LambdaBuffers.Compiler.KindCheck.Inference qualified as I
4141import LambdaBuffers.Compiler.KindCheck.Type (Type (App ))
42- import LambdaBuffers.Compiler.KindCheck.Type qualified as P
4342import LambdaBuffers.Compiler.KindCheck.Variable (Variable (ForeignRef , LocalRef ))
4443import LambdaBuffers.Compiler.ProtoCompat (kind2ProtoKind )
4544import LambdaBuffers.Compiler.ProtoCompat.Types qualified as P (
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -2,12 +2,8 @@ module Test.Samples.Proto.TyDef (tyDef'maybe, tyDef'incoherent) where
22
33import LambdaBuffers.Compiler.ProtoCompat qualified as P
44import 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
2016tyDef'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
3127tyDef'incoherent :: P. TyDef
3228tyDef'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 )
You can’t perform that action at this time.
0 commit comments