@@ -2,40 +2,28 @@ module PureScript.Backend.Chez.Syntax where
3import Prelude
3import Prelude
5−import Control.Alternative as Alternative
6import Data.Argonaut as Json
5import Data.Argonaut as Json
7import Data.Array as Array
6import Data.Array as Array
8import Data.Array.NonEmpty (NonEmptyArray)
7import Data.Array.NonEmpty (NonEmptyArray)
9−import Data.Array.NonEmpty as NEA
10import Data.Array.NonEmpty as NonEmptyArray
8import Data.Array.NonEmpty as NonEmptyArray
11−import Data.Maybe (Maybe(..), maybe)
9+import Data.Maybe (Maybe)
12−import Data.Newtype (class Newtype, un)
10+import Data.Newtype (class Newtype)
13−import Data.String (Pattern(..), Replacement(..))
11+import Data.Tuple (Tuple)
14−import Data.String as String
15−import Data.String.Regex as R
16−import Data.String.Regex.Flags as R.Flags
17−import Data.String.Regex.Unsafe as R.Unsafe
20−import Partial.Unsafe (unsafeCrashWith)
22−import PureScript.Backend.Chez.Constants (libChezSchemePrefix, scmPrefixed)
12+import PureScript.Backend.Chez.Constants (scmPrefixed)
23−import PureScript.Backend.Optimizer.CoreFn (Ident(..), ModuleName(..), Prop(..), Qualified(..))
13+import PureScript.Backend.Optimizer.CoreFn (Prop(..))
24−import PureScript.Backend.Optimizer.Syntax (Level(..))
25−import Safe.Coerce (coerce)
27type ChezLibrary =
15type ChezLibrary =
28− { "#!r6rs" :: Prim.Boolean
16+ { "#!r6rs" :: Boolean
29− , "#!chezscheme" :: Prim.Boolean
17+ , "#!chezscheme" :: Boolean
30 , name :: LibraryName
18 , name :: LibraryName
31− , exports :: Prim.Array ChezExport
19+ , exports :: Array ChezExport
32− , imports :: Prim.Array ChezImport
20+ , imports :: Array ChezImport
33 , body :: LibraryBody
21 , body :: LibraryBody
36type LibraryName =
24type LibraryName =
37− { identifiers :: NonEmptyArray Prim.String
25+ { identifiers :: NonEmptyArray String
38− , version :: Prim.Array LibraryVersion
26+ , version :: Array LibraryVersion
41newtype LibraryVersion = LibraryVersion Prim.Int
29newtype LibraryVersion = LibraryVersion Prim.Int
@@ -43,31 +31,31 @@ newtype LibraryVersion = LibraryVersion Prim.Int
43derive instance Newtype LibraryVersion _
31derive instance Newtype LibraryVersion _
45data ChezExport
33data ChezExport
46− = ExportIdentifier Prim.String
34+ = ExportIdentifier String
47− | ExportRename (Prim.Array { original :: Prim.String, rename :: Prim.String })
35+ | ExportRename (Array { original :: String, rename :: String })
49type LibraryReference =
37type LibraryReference =
50− { identifiers :: NonEmptyArray Prim.String
38+ { identifiers :: NonEmptyArray String
51 , version :: Maybe VersionReference
39 , version :: Maybe VersionReference
54data VersionReference
42data VersionReference
55 = VersionRef (NonEmptyArray SubVersionReference)
43 = VersionRef (NonEmptyArray SubVersionReference)
56− | VersionAnd (Prim.Array VersionReference)
44+ | VersionAnd (Array VersionReference)
57− | VersionOr (Prim.Array VersionReference)
45+ | VersionOr (Array VersionReference)
58 | VersionNot VersionReference
46 | VersionNot VersionReference
60data SubVersionReference
48data SubVersionReference
61 = SubVersionRef LibraryVersion
49 = SubVersionRef LibraryVersion
62 | SubVersionGTE LibraryVersion
50 | SubVersionGTE LibraryVersion
63 | SubVersionLTE LibraryVersion
51 | SubVersionLTE LibraryVersion
64− | SubVersionAnd (Prim.Array SubVersionReference)
52+ | SubVersionAnd (Array SubVersionReference)
65− | SubVersionOr (Prim.Array SubVersionReference)
53+ | SubVersionOr (Array SubVersionReference)
66 | SubVersionNot SubVersionReference
54 | SubVersionNot SubVersionReference
68data ChezImport
56data ChezImport
69 = ImportSet ChezImportSet
57 = ImportSet ChezImportSet
70− | ImportFor ChezImportSet (Prim.Array ChezImportLevel)
58+ | ImportFor ChezImportSet (Array ChezImportLevel)
72data ChezImportLevel
60data ChezImportLevel
73 = ImportLevelRun
61 = ImportLevelRun
@@ -76,23 +64,23 @@ data ChezImportLevel
77data ChezImportSet
65data ChezImportSet
78 = ImportLibrary LibraryReference
66 = ImportLibrary LibraryReference
79− | ImportOnly ChezImportSet (Prim.Array Prim.String)
67+ | ImportOnly ChezImportSet (Array String)
80− | ImportExcept ChezImportSet (Prim.Array Prim.String)
68+ | ImportExcept ChezImportSet (Array String)
81− | ImportPrefix ChezImportSet Prim.String
69+ | ImportPrefix ChezImportSet String
82− | ImportRename ChezImportSet (Prim.Array { original :: Prim.String, rename :: Prim.String })
70+ | ImportRename ChezImportSet (Array { original :: String, rename :: String })
84type LibraryBody =
72type LibraryBody =
85− { definitions :: Prim.Array ChezDefinition
73+ { definitions :: Array ChezDefinition
86− , expressions :: Prim.Array ChezExpr
74+ , expressions :: Array ChezExpr
89data ChezDefinition
77data ChezDefinition
90− = DefineValue Prim.String ChezExpr
78+ = DefineValue String ChezExpr
91− | DefineCurriedFunction Prim.String (NonEmptyArray Prim.String) ChezExpr
79+ | DefineCurriedFunction String (NonEmptyArray String) ChezExpr
92− | DefineUncurriedFunction Prim.String (Prim.Array Prim.String) ChezExpr
80+ | DefineUncurriedFunction String (Array String) ChezExpr
93− | DefineRecordType Prim.String (Prim.Array Prim.String)
81+ | DefineRecordType String (Array String)
95−newtype LiteralDigit = LiteralDigit Prim.String
83+newtype LiteralDigit = LiteralDigit String
97derive instance Newtype LiteralDigit _
85derive instance Newtype LiteralDigit _
98derive newtype instance Eq LiteralDigit
86derive newtype instance Eq LiteralDigit
@@ -101,394 +89,41 @@ derive newtype instance Ord LiteralDigit
101data ChezExpr
89data ChezExpr
102 = Integer LiteralDigit
90 = Integer LiteralDigit
103 | Float LiteralDigit
91 | Float LiteralDigit
104− | Char Prim.String
92+ | Char String
105− | String Prim.String
93+ | StringExpr String
106− | Boolean Prim.Boolean
94+ | Bool Boolean
107− | Identifier Prim.String
95+ | Identifier String
108− | List (Prim.Array ChezExpr)
96+ | List (Array ChezExpr)
109−
97+ | Cond (NonEmptyArray (Tuple ChezExpr ChezExpr)) (Maybe ChezExpr)
110−definitionIdentifiers :: ChezDefinition -> Prim.Array Prim.String
98+ | Let Boolean (NonEmptyArray (Tuple String ChezExpr)) ChezExpr
111−definitionIdentifiers (DefineValue i _) = [ i ]
99+ | Lambda (Array String) ChezExpr
112−definitionIdentifiers (DefineCurriedFunction i _ _) = [ i ]
113−definitionIdentifiers (DefineUncurriedFunction i _ _) = [ i ]
114−definitionIdentifiers (DefineRecordType i [ x ]) =
115− [ recordTypeCurriedConstructor i
116− , recordTypePredicate i
117− , recordTypeAccessor i x
119−definitionIdentifiers (DefineRecordType i fields) =
120− [ recordTypeUncurriedConstructor i
121− , recordTypePredicate i
122− ] <> map (recordTypeAccessor i) fields
124−resolve :: ModuleName -> Qualified Ident -> Prim.String
125−resolve _ (Qualified Nothing (Ident i)) = i
126−resolve currentModule (Qualified (Just m) (Ident i))
127− | currentModule == m = i
128− | otherwise = coerce m <> "." <> i
130−printWrap :: Doc Void -> Doc Void -> Doc Void -> Doc Void
131−printWrap l r x = l <> x <> r
133−printList :: Doc Void -> Doc Void
134−printList = printWrap (D.text "(") (D.text ")")
136−printNamedList :: Prim.String -> Doc Void -> Doc Void
137−printNamedList name body
139− printList $ D.text name
141− printList $ D.words [ D.text name, body ]
143−printIndentedList :: Doc Void -> Doc Void -> Doc Void
144−printIndentedList ident body
149− [ D.text "(" <> ident
150− , D.indent body <> D.text ")"
153−linesSeparated :: Prim.Array (Doc Void) -> Doc Void
154−linesSeparated = Array.intercalate twoLineBreaks
156− twoLineBreaks = D.break <> D.break
158−escapeIdentifiers :: ChezLibrary -> ChezLibrary
159−escapeIdentifiers lib = lib
160− { name = lib.name { identifiers = map escapeIdent lib.name.identifiers }
161− , exports = map escapeExport lib.exports
162− , imports = map escapeImport lib.imports
164− { definitions: escapeDefinition <$> lib.body.definitions
165− , expressions: escapeExpr <$> lib.body.expressions
169− escapeIdent = String.replaceAll (Pattern "'") (Replacement "$p")
170− escapeExport = case _ of
171− ExportIdentifier x -> ExportIdentifier $ escapeIdent x
172− ExportRename arr -> ExportRename $ arr <#> \r ->
173− { original: escapeIdent r.original, rename: escapeIdent r.rename }
175− escapeImport = case _ of
176− ImportSet set -> ImportSet $ escapeImportSet set
177− ImportFor set lvls -> ImportFor (escapeImportSet set) lvls
179− escapeImportSet = case _ of
180− ImportLibrary libRef ->
181− ImportLibrary $ escapeLibRef libRef
182− ImportOnly set idents ->
183− ImportOnly (escapeImportSet set) $ map escapeIdent idents
184− ImportExcept set idents ->
185− ImportExcept (escapeImportSet set) $ map escapeIdent idents
186− ImportPrefix set ident ->
187− ImportPrefix (escapeImportSet set) $ escapeIdent ident
188− ImportRename set renames ->
189− ImportRename (escapeImportSet set) $ renames <#> \r ->
190− { original: escapeIdent r.original, rename: escapeIdent r.rename }
192− escapeLibRef libRef = libRef { identifiers = map escapeIdent libRef.identifiers }
194− escapeDefinition = case _ of
195− DefineValue i expr -> DefineValue (escapeIdent i) $ escapeExpr expr
196− DefineCurriedFunction i args expr ->
197− DefineCurriedFunction (escapeIdent i) (map escapeIdent args) $ escapeExpr expr
198− DefineUncurriedFunction i args expr ->
199− DefineUncurriedFunction (escapeIdent i) (map escapeIdent args) $ escapeExpr expr
200− DefineRecordType i fields -> DefineRecordType (escapeIdent i) $ map escapeIdent fields
202− escapeExpr = case _ of
203− Identifier i -> Identifier $ escapeIdent i
204− List exprs -> List $ map escapeExpr exprs
211−printLibrary :: ChezLibrary -> Doc Void
212−printLibrary = escapeIdentifiers >>> printLibrary'
214−printLibrary' :: ChezLibrary -> Doc Void
219− [ D.text "#!r6rs" <$ Alternative.guard lib."#!r6rs"
220− , D.text "#!chezscheme" <$ Alternative.guard lib."#!chezscheme"
221− , Just $ printNamedIndentedList (D.text "library") $ D.lines
222− [ printLibraryName lib.name
223− , printIndentedList (D.text "export") $ D.lines $ map printExport lib.exports
224− , (printIndentedList (D.text "import") $ D.lines $ map printImport lib.imports)
226− , printBody lib.body
230−printLibraryName :: LibraryName -> Doc Void
231−printLibraryName { identifiers, version } =
233− [ D.words $ map D.text identifiers
236− _ -> printList $ D.words $ map printLibraryVersion version
239−printLibraryVersion :: LibraryVersion -> Doc Void
240−printLibraryVersion = D.text <<< show <<< un LibraryVersion
242−printExport :: ChezExport -> Doc Void
243−printExport = case _ of
244− ExportIdentifier s -> D.text s
246− printNamedList "rename"
248− $ map (\r -> printList $ D.words [ D.text r.original, D.text r.rename ]) arr
250−printImport :: ChezImport -> Doc Void
251−printImport = case _ of
252− ImportSet is -> printImportSet is
253− ImportFor is lvls ->
254− printNamedList "for" $ D.words
256− , D.words $ map printImportLevel lvls
259−printImportLevel :: ChezImportLevel -> Doc Void
260−printImportLevel = case _ of
261− ImportLevelRun -> D.text "run"
262− ImportLevelExpand -> D.text "expand"
263− ImportLevelMeta level -> printNamedList "meta" $ D.text $ show level
265−printImportSet :: ChezImportSet -> Doc Void
266−printImportSet = case _ of
267− ImportLibrary libRef ->
268− printLibraryReference libRef
269− ImportOnly impSet identifiers ->
270− printNamedList "only" $ D.words
271− [ printImportSet impSet, D.words $ map D.text identifiers ]
272− ImportExcept impSet identifiers ->
273− printNamedList "except" $ D.words
274− [ printImportSet impSet, D.words $ map D.text identifiers ]
275− ImportPrefix impSet rename ->
276− printNamedList "prefix" $ D.words [ printImportSet impSet, D.text rename ]
277− ImportRename impSet identifiers ->
278− printNamedList "rename" $ D.words
279− [ printImportSet impSet
280− , D.words $ map (\r -> printList $ D.words $ map D.text [ r.original, r.rename ])
284−printLibraryReference :: LibraryReference -> Doc Void
285−printLibraryReference lib = do
288− | Array.elem (NEA.head lib.identifiers)
289− [ "for", "library", "only", "except", "prefix", "rename" ] =
290− printNamedList "library"
293− printListFn $ D.words
294− [ D.words $ map D.text lib.identifiers
295− , maybe mempty printVersionReference lib.version
298−printVersionReference :: VersionReference -> Doc Void
299−printVersionReference = case _ of
301− printList $ D.words $ map printSubVersionReference ref
303− printNamedList "and" $ D.words $ map printVersionReference ref
305− printNamedList "or" $ D.words $ map printVersionReference ref
307− printNamedList "not" $ printVersionReference ref
309−printSubVersionReference :: SubVersionReference -> Doc Void
310−printSubVersionReference = case _ of
311− SubVersionRef ref -> printList $ printLibraryVersion ref
312− SubVersionGTE ref -> printNamedList ">=" $ printLibraryVersion ref
313− SubVersionLTE ref -> printNamedList "<=" $ printLibraryVersion ref
314− SubVersionAnd ref -> printNamedList "and" $ D.words
315− $ map printSubVersionReference ref
316− SubVersionOr ref -> printNamedList "or" $ D.words
317− $ map printSubVersionReference ref
318− SubVersionNot ref -> printNamedList "not" $ printSubVersionReference ref
320−printBody :: LibraryBody -> Doc Void
323− defs = map printDefinition lib.definitions
324− exprs = map printChezExpr lib.expressions
325− linesSeparated $ defs <> exprs
327−printNamedIndentedList :: Doc Void -> Doc Void -> Doc Void
328−printNamedIndentedList firstLine body
333− [ D.text "(" <> firstLine
334− , D.indent $ body <> D.text ")"
337−printDefinition :: ChezDefinition -> Doc Void
338−printDefinition = case _ of
339− DefineValue ident expr ->
340− printNamedIndentedList (D.words [ D.text $ scmPrefixed "define", D.text ident ])
341− $ printChezExpr expr
342− DefineCurriedFunction ident args expr ->
343− printNamedIndentedList (D.text (scmPrefixed "define ") <> D.text ident)
344− $ printCurriedAbs (NEA.toArray args) expr
345− DefineUncurriedFunction ident args expr ->
346− printNamedIndentedList (D.text (scmPrefixed "define ") <> D.text ident)
347− $ printNamedIndentedList
348− (D.text (scmPrefixed "lambda ") <> printList (D.words $ map D.text args))
349− (printChezExpr expr)
350− DefineRecordType ident [ field ] ->
351− printRecordDefinition
353− (recordTypeName ident)
354− (recordTypeCurriedConstructor ident)
355− (recordTypePredicate ident)
357− DefineRecordType ident fields ->
358− printRecordDefinition
360− (recordTypeName ident)
361− (recordTypeUncurriedConstructor ident)
362− (recordTypePredicate ident)
365−printCurriedAbs :: Prim.Array Prim.String -> ChezExpr -> Doc Void
366−printCurriedAbs args body = Array.foldr foldFn (printChezExpr body) args
368− foldFn next bodyOrRest =
369− printNamedIndentedList
370− (D.words [ D.text $ scmPrefixed "lambda", printList (D.text next) ])
373−printChezExpr :: forall a. ChezExpr -> Doc a
374−printChezExpr e = case e of
375− Integer (LiteralDigit x) -> D.text x
376− Float (LiteralDigit x) -> D.text x
378− String x -> D.text x
379− Boolean x -> D.text $ if x then "#t" else "#f"
380− Identifier x -> D.text x
381− List xs -> D.text "(" <> D.words (printChezExpr <$> xs) <> D.text ")"
383−printRecordDefinition
388− -> Prim.Array Prim.String
390−printRecordDefinition ident name constructor predicate fields =
391− printNamedIndentedList defineForm fieldsForm
393− defineForm :: Doc Void
394− defineForm = D.words
395− [ D.text $ scmPrefixed "define-record-type"
396− , printList $ D.words $ map D.text [ name, constructor, predicate ]
399− fieldForm :: Prim.String -> Doc Void
400− fieldForm field = printList $ D.words
401− $ map D.text [ scmPrefixed "immutable", field, recordTypeAccessor ident field ]
403− fieldsForm :: Doc Void
404− fieldsForm = printList $ D.words $ Array.cons (D.text $ scmPrefixed "fields")
405− $ map fieldForm fields
407−toChezIdent :: Maybe Ident -> Level -> Prim.String
408−toChezIdent i (Level l) = case i of
409− Just (Ident i') -> case i' of
412− Nothing -> "_" <> show l
414−jsonToChezString :: Prim.String -> Prim.String
415−jsonToChezString str = unicodeReplace str
417− unicodeRegex :: R.Regex
418− unicodeRegex = R.Unsafe.unsafeRegex """\\u([A-F\d]{4})""" R.Flags.global
420− unicodeReplace :: Prim.String -> Prim.String
421− unicodeReplace s = R.replace' unicodeRegex unicodeReplaceMatch s
425− -> Prim.Array (Maybe Prim.String)
427− unicodeReplaceMatch _ = case _ of
428− [ (Just x) ] -> "\\x" <> x <> ";"
429− _ -> unsafeCrashWith "Error matching at unicodeReplaceMatch in jsonToChezString"
433−chezCond :: NonEmptyArray { c :: ChezExpr, e :: ChezExpr } -> Maybe ChezExpr -> ChezExpr
436− b' :: Prim.Array ChezExpr
437− b' = NonEmptyArray.toArray b <#> \{ c, e } -> List [ c, e ]
439− o' :: Prim.Array ChezExpr
440− o' = Array.fromFoldable o <#> \x -> List [ Identifier $ scmPrefixed "else", x ]
442− List $ [ Identifier $ scmPrefixed "cond" ] <> b' <> o'
444−chezUncurriedApplication :: ChezExpr -> Prim.Array ChezExpr -> ChezExpr
103+runUncurriedFn :: ChezExpr -> Array ChezExpr -> ChezExpr
445−chezUncurriedApplication f s = List $ Array.cons f s
104+runUncurriedFn f s = List $ Array.cons f s
447−chezUncurriedFunction :: Prim.Array Prim.String -> ChezExpr -> ChezExpr
106+mkUncurriedFn :: Array String -> ChezExpr -> ChezExpr
448−chezUncurriedFunction a e = List
107+mkUncurriedFn a e = Lambda a e
449− [ Identifier $ scmPrefixed "lambda", List $ Identifier <$> a, e ]
451−chezCurriedApplication :: ChezExpr -> NonEmptyArray ChezExpr -> ChezExpr
109+runCurriedFn :: ChezExpr -> NonEmptyArray ChezExpr -> ChezExpr
452−chezCurriedApplication f s = NonEmptyArray.foldl1 app $ NonEmptyArray.cons f s
110+runCurriedFn f s = NonEmptyArray.foldl1 app $ NonEmptyArray.cons f s
454−chezCurriedFunction :: NonEmptyArray Prim.String -> ChezExpr -> ChezExpr
112+mkCurriedFn :: NonEmptyArray String -> ChezExpr -> ChezExpr
455−chezCurriedFunction a e = Array.foldr lambda e $ NonEmptyArray.toArray a
113+mkCurriedFn a e = Array.foldr (Lambda <<< Array.singleton) e $ NonEmptyArray.toArray a
457−chezThunk :: ChezExpr -> ChezExpr
115+thunk :: ChezExpr -> ChezExpr
458−chezThunk e = List [ Identifier $ scmPrefixed "lambda", List [], e ]
116+thunk e = Lambda [] e
460−chezUnthunk :: ChezExpr -> ChezExpr
118+unthunk :: ChezExpr -> ChezExpr
461−chezUnthunk e = List [ e ]
119+unthunk e = List [ e ]
465app :: ChezExpr -> ChezExpr -> ChezExpr
123app :: ChezExpr -> ChezExpr -> ChezExpr
466app f x = List [ f, x ]
124app f x = List [ f, x ]
468−define :: Ident -> ChezExpr -> ChezExpr
469−define i e = List [ Identifier $ scmPrefixed "define", Identifier $ coerce i, e ]
471−library :: ModuleName -> Prim.Array Ident -> Prim.Array ChezExpr -> ChezExpr
472−library moduleName exports bindings =
474− [ Identifier "library"
475− , Identifier $ "(" <> coerce moduleName <> " lib" <> ")"
477− [ Identifier "export"
478− ] <> (Identifier <$> coerce exports)
480− [ Identifier "import"
482− [ Identifier "prefix"
484− [ Identifier "chezscheme"
486− , Identifier libChezSchemePrefix
491−record :: Prim.Array (Prop ChezExpr) -> ChezExpr
126+record :: Array (Prop ChezExpr) -> ChezExpr
492record r =
127record r =
494 field :: Prop ChezExpr -> ChezExpr
129 field :: Prop ChezExpr -> ChezExpr
@@ -496,7 +131,7 @@ record r =
497 [ Identifier $ scmPrefixed "hashtable-set!"
132 [ Identifier $ scmPrefixed "hashtable-set!"
498 , Identifier "$record"
133 , Identifier "$record"
499− , String $ Json.stringify $ Json.fromString k
134+ , StringExpr $ Json.stringify $ Json.fromString k
@@ -518,29 +153,26 @@ quote :: ChezExpr -> ChezExpr
518quote e = app (Identifier $ scmPrefixed "quote") e
153quote e = app (Identifier $ scmPrefixed "quote") e
520eqQ :: ChezExpr -> ChezExpr -> ChezExpr
155eqQ :: ChezExpr -> ChezExpr -> ChezExpr
521−eqQ x y = chezUncurriedApplication (Identifier $ scmPrefixed "eq?") [ x, y ]
156+eqQ x y = runUncurriedFn (Identifier $ scmPrefixed "eq?") [ x, y ]
523−lambda :: Prim.String -> ChezExpr -> ChezExpr
524−lambda a e = List [ Identifier $ scmPrefixed "lambda", List [ Identifier a ], e ]
526−vector :: Prim.Array ChezExpr -> ChezExpr
158+vector :: Array ChezExpr -> ChezExpr
527vector = List <<< Array.cons (Identifier $ scmPrefixed "vector")
159vector = List <<< Array.cons (Identifier $ scmPrefixed "vector")
529−recordTypeName :: Prim.String -> Prim.String
161+recordTypeName :: String -> String
530recordTypeName i = i <> "$"
162recordTypeName i = i <> "$"
532−recordTypeCurriedConstructor :: Prim.String -> Prim.String
164+recordTypeCurriedConstructor :: String -> String
533recordTypeCurriedConstructor i = i
165recordTypeCurriedConstructor i = i
535−recordTypeUncurriedConstructor :: Prim.String -> Prim.String
167+recordTypeUncurriedConstructor :: String -> String
536recordTypeUncurriedConstructor i = i <> "*"
168recordTypeUncurriedConstructor i = i <> "*"
538−recordTypePredicate :: Prim.String -> Prim.String
170+recordTypePredicate :: String -> String
539recordTypePredicate i = i <> "?"
171recordTypePredicate i = i <> "?"
541−recordTypeAccessor :: Prim.String -> Prim.String -> Prim.String
173+recordTypeAccessor :: String -> String -> String
542recordTypeAccessor i field = i <> "-" <> field
174recordTypeAccessor i field = i <> "-" <> field
544−recordAccessor :: ChezExpr -> Prim.String -> Prim.String -> ChezExpr
176+recordAccessor :: ChezExpr -> String -> String -> ChezExpr
545recordAccessor expr name field =
177recordAccessor expr name field =
546− chezUncurriedApplication (Identifier $ recordTypeAccessor name field) [ expr ]
178+ runUncurriedFn (Identifier $ recordTypeAccessor name field) [ expr ]