Move the closed record update optimization (#4489) · purescript/purescript@cf53018 · GitHub
Skip to content

Commit cf53018

Browse files
authored
Move the closed record update optimization (#4489)
For consumers of CoreFn like alternate backends, the optimization of replacing a closed record update with an object literal has now been moved to the point of desugaring CoreFn into JS. The `ObjectUpdate` expression constructor now contains a `Maybe` field holding a list of record labels to be copied as-is, for backends that want to perform this optimization also. This optimization was the last use of the `Maybe SourceType` member of the `Ann` tuple, so it has been removed. CoreFn is now fully untyped in both its serialized and in-memory forms (previously it was partially typed in memory).
1 parent 193977e commit cf53018

15 files changed

Lines changed: 153 additions & 118 deletions

File tree

Lines changed: 7 additions & 0 deletions

‎src/Language/PureScript/CodeGen/JS.hs‎

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ moduleBindToJs mn = bindToJs
240240
where
241241
-- Generate code in the simplified JavaScript intermediate representation for a declaration
242242
bindToJs :: Bind Ann -> m [AST]
243-
bindToJs (NonRec (_, _, _, Just IsTypeClassConstructor) _ _) = pure []
243+
bindToJs (NonRec (_, _, Just IsTypeClassConstructor) _ _) = pure []
244244
-- Unlike other newtype constructors, type class constructors are only
245245
-- ever applied; it's not possible to use them as values. So it's safe to
246246
-- erase them.
@@ -252,20 +252,20 @@ moduleBindToJs mn = bindToJs
252252
--
253253
-- The main purpose of this function is to handle code generation for comments.
254254
nonRecToJS :: Ann -> Ident -> Expr Ann -> m AST
255-
nonRecToJS a i e@(extractAnn -> (_, com, _, _)) | not (null com) = do
255+
nonRecToJS a i e@(extractAnn -> (_, com, _)) | not (null com) = do
256256
withoutComment <- asks optionsNoComments
257257
if withoutComment
258258
then nonRecToJS a i (modifyAnn removeComments e)
259259
else AST.Comment (AST.SourceComments com) <$> nonRecToJS a i (modifyAnn removeComments e)
260-
nonRecToJS (ss, _, _, _) ident val = do
260+
nonRecToJS (ss, _, _) ident val = do
261261
js <- valueToJs val
262262
withPos ss $ AST.VariableIntroduction Nothing (identToJs ident) (Just (guessEffects val, js))
263263

264264
guessEffects :: Expr Ann -> AST.InitializerEffects
265265
guessEffects = \case
266-
Var _ (Qualified (BySourcePos _) _) -> NoEffects
267-
App (_, _, _, Just IsSyntheticApp) _ _ -> NoEffects
268-
_ -> UnknownEffects
266+
Var _ (Qualified (BySourcePos _) _) -> NoEffects
267+
App (_, _, Just IsSyntheticApp) _ _ -> NoEffects
268+
_ -> UnknownEffects
269269

270270
withPos :: SourceSpan -> AST -> m AST
271271
withPos ss js = do
@@ -282,22 +282,25 @@ moduleBindToJs mn = bindToJs
282282
-- Generate code in the simplified JavaScript intermediate representation for a value or expression.
283283
valueToJs :: Expr Ann -> m AST
284284
valueToJs e =
285-
let (ss, _, _, _) = extractAnn e in
285+
let (ss, _, _) = extractAnn e in
286286
withPos ss =<< valueToJs' e
287287

288288
valueToJs' :: Expr Ann -> m AST
289-
valueToJs' (Literal (pos, _, _, _) l) =
289+
valueToJs' (Literal (pos, _, _) l) =
290290
rethrowWithPosition pos $ literalToValueJS pos l
291-
valueToJs' (Var (_, _, _, Just (IsConstructor _ [])) name) =
291+
valueToJs' (Var (_, _, Just (IsConstructor _ [])) name) =
292292
return $ accessorString "value" $ qualifiedToJS id name
293-
valueToJs' (Var (_, _, _, Just (IsConstructor _ _)) name) =
293+
valueToJs' (Var (_, _, Just (IsConstructor _ _)) name) =
294294
return $ accessorString "create" $ qualifiedToJS id name
295295
valueToJs' (Accessor _ prop val) =
296296
accessorString prop <$> valueToJs val
297-
valueToJs' (ObjectUpdate _ o ps) = do
297+
valueToJs' (ObjectUpdate (pos, _, _) o copy ps) = do
298298
obj <- valueToJs o
299299
sts <- mapM (sndM valueToJs) ps
300-
extendObj obj sts
300+
case copy of
301+
Nothing -> extendObj obj sts
302+
Just names -> pure $ AST.ObjectLiteral (Just pos) (map f names ++ sts)
303+
where f name = (name, accessorString name obj)
301304
valueToJs' (Abs _ arg val) = do
302305
ret <- valueToJs val
303306
let jsArg = case arg of
@@ -308,29 +311,29 @@ moduleBindToJs mn = bindToJs
308311
let (f, args) = unApp e []
309312
args' <- mapM valueToJs args
310313
case f of
311-
Var (_, _, _, Just IsNewtype) _ -> return (head args')
312-
Var (_, _, _, Just (IsConstructor _ fields)) name | length args == length fields ->
314+
Var (_, _, Just IsNewtype) _ -> return (head args')
315+
Var (_, _, Just (IsConstructor _ fields)) name | length args == length fields ->
313316
return $ AST.Unary Nothing AST.New $ AST.App Nothing (qualifiedToJS id name) args'
314317
_ -> flip (foldl (\fn a -> AST.App Nothing fn [a])) args' <$> valueToJs f
315318
where
316319
unApp :: Expr Ann -> [Expr Ann] -> (Expr Ann, [Expr Ann])
317320
unApp (App _ val arg) args = unApp val (arg : args)
318321
unApp other args = (other, args)
319-
valueToJs' (Var (_, _, _, Just IsForeign) qi@(Qualified (ByModuleName mn') ident)) =
322+
valueToJs' (Var (_, _, Just IsForeign) qi@(Qualified (ByModuleName mn') ident)) =
320323
return $ if mn' == mn
321324
then foreignIdent ident
322325
else varToJs qi
323-
valueToJs' (Var (_, _, _, Just IsForeign) ident) =
326+
valueToJs' (Var (_, _, Just IsForeign) ident) =
324327
internalError $ "Encountered an unqualified reference to a foreign ident " ++ T.unpack (showQualified showIdent ident)
325328
valueToJs' (Var _ ident) = return $ varToJs ident
326-
valueToJs' (Case (ss, _, _, _) values binders) = do
329+
valueToJs' (Case (ss, _, _) values binders) = do
327330
vals <- mapM valueToJs values
328331
bindersToJs ss binders vals
329332
valueToJs' (Let _ ds val) = do
330333
ds' <- concat <$> mapM bindToJs ds
331334
ret <- valueToJs val
332335
return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing (ds' ++ [AST.Return Nothing ret]))) []
333-
valueToJs' (Constructor (_, _, _, Just IsNewtype) _ ctor _) =
336+
valueToJs' (Constructor (_, _, Just IsNewtype) _ ctor _) =
334337
return $ AST.VariableIntroduction Nothing (properToJs ctor) (Just . (UnknownEffects, ) $
335338
AST.ObjectLiteral Nothing [("create",
336339
AST.Function Nothing Nothing ["value"]
@@ -442,7 +445,7 @@ moduleBindToJs mn = bindToJs
442445

443446
binderToJs :: Text -> [AST] -> Binder Ann -> m [AST]
444447
binderToJs s done binder =
445-
let (ss, _, _, _) = extractBinderAnn binder in
448+
let (ss, _, _) = extractBinderAnn binder in
446449
traverse (withPos ss) =<< binderToJs' s done binder
447450

448451
-- Generate code in the simplified JavaScript intermediate representation for a pattern match
@@ -453,9 +456,9 @@ moduleBindToJs mn = bindToJs
453456
literalToBinderJS varName done l
454457
binderToJs' varName done (VarBinder _ ident) =
455458
return (AST.VariableIntroduction Nothing (identToJs ident) (Just (NoEffects, AST.Var Nothing varName)) : done)
456-
binderToJs' varName done (ConstructorBinder (_, _, _, Just IsNewtype) _ _ [b]) =
459+
binderToJs' varName done (ConstructorBinder (_, _, Just IsNewtype) _ _ [b]) =
457460
binderToJs varName done b
458-
binderToJs' varName done (ConstructorBinder (_, _, _, Just (IsConstructor ctorType fields)) _ ctor bs) = do
461+
binderToJs' varName done (ConstructorBinder (_, _, Just (IsConstructor ctorType fields)) _ ctor bs) = do
459462
js <- go (zip fields bs) done
460463
return $ case ctorType of
461464
ProductType -> js

‎src/Language/PureScript/CoreFn/Ann.hs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@ import Prelude
55
import Language.PureScript.AST.SourcePos (SourceSpan)
66
import Language.PureScript.Comments (Comment)
77
import Language.PureScript.CoreFn.Meta (Meta)
8-
import Language.PureScript.Types (SourceType)
98

109
-- |
1110
-- Type alias for basic annotations
1211
--
13-
type Ann = (SourceSpan, [Comment], Maybe SourceType, Maybe Meta)
12+
type Ann = (SourceSpan, [Comment], Maybe Meta)
1413

1514
-- |
1615
-- An annotation empty of metadata aside from a source span.
1716
--
1817
ssAnn :: SourceSpan -> Ann
19-
ssAnn ss = (ss, [], Nothing, Nothing)
18+
ssAnn ss = (ss, [], Nothing)
2019

2120
-- |
2221
-- Remove the comments from an annotation
2322
--
2423
removeComments :: Ann -> Ann
25-
removeComments (ss, _, ty, meta) = (ss, [], ty, meta)
24+
removeComments (ss, _, meta) = (ss, [], meta)

‎src/Language/PureScript/CoreFn/CSE.hs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ generateIdentFor d e = at d . non mempty . at e %%<~ \case
262262
_ -> "ref"
263263

264264
nullAnn :: Ann
265-
nullAnn = (nullSourceSpan, [], Nothing, Nothing)
265+
nullAnn = (nullSourceSpan, [], Nothing)
266266

267267
-- |
268268
-- Use a map to substitute local Vars in a list of Binds.
@@ -386,8 +386,8 @@ optimizeCommonSubexpressions mn
386386
-- common subexpression elimination pass.
387387
shouldFloatExpr :: Expr Ann -> Bool
388388
shouldFloatExpr = \case
389-
App (_, _, _, Just IsSyntheticApp) e _ -> isSimple e
390-
_ -> False
389+
App (_, _, Just IsSyntheticApp) e _ -> isSimple e
390+
_ -> False
391391

392392
isSimple :: Expr Ann -> Bool
393393
isSimple = \case

‎src/Language/PureScript/CoreFn/Desugar.hs‎

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ import Language.PureScript.CoreFn.Meta (ConstructorType(..), Meta(..))
2222
import Language.PureScript.CoreFn.Module (Module(..))
2323
import Language.PureScript.Crash (internalError)
2424
import Language.PureScript.Environment (DataDeclType(..), Environment(..), NameKind(..), isDictTypeName, lookupConstructor, lookupValue)
25+
import Language.PureScript.Label (Label(..))
2526
import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), getQual)
26-
import Language.PureScript.Types (SourceType)
27+
import Language.PureScript.PSString (PSString)
28+
import Language.PureScript.Types (pattern REmptyKinded, SourceType, Type(..))
2729
import Language.PureScript.AST qualified as A
2830
import Language.PureScript.Constants.Prim qualified as C
2931

@@ -57,13 +59,13 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
5759
dedupeImports = fmap swap . M.toList . M.fromListWith const . fmap swap
5860

5961
ssA :: SourceSpan -> Ann
60-
ssA ss = (ss, [], Nothing, Nothing)
62+
ssA ss = (ss, [], Nothing)
6163

6264
-- Desugars member declarations from AST to CoreFn representation.
6365
declToCoreFn :: A.Declaration -> [Bind Ann]
6466
declToCoreFn (A.DataDeclaration (ss, com) Newtype _ _ [ctor]) =
65-
[NonRec (ss, [], Nothing, declMeta) (properToIdent $ A.dataCtorName ctor) $
66-
Abs (ss, com, Nothing, Just IsNewtype) (Ident "x") (Var (ssAnn ss) $ Qualified ByNullSourcePos (Ident "x"))]
67+
[NonRec (ss, [], declMeta) (properToIdent $ A.dataCtorName ctor) $
68+
Abs (ss, com, Just IsNewtype) (Ident "x") (Var (ssAnn ss) $ Qualified ByNullSourcePos (Ident "x"))]
6769
where
6870
declMeta = isDictTypeName (A.dataCtorName ctor) `orEmpty` IsTypeClassConstructor
6971
declToCoreFn d@(A.DataDeclaration _ Newtype _ _ _) =
@@ -73,7 +75,7 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
7375
let
7476
ctor = A.dataCtorName ctorDecl
7577
(_, _, _, fields) = lookupConstructor env (Qualified (ByModuleName mn) ctor)
76-
in NonRec (ssA ss) (properToIdent ctor) $ Constructor (ss, com, Nothing, Nothing) tyName ctor fields
78+
in NonRec (ssA ss) (properToIdent ctor) $ Constructor (ss, com, Nothing) tyName ctor fields
7779
declToCoreFn (A.DataBindingGroupDeclaration ds) =
7880
concatMap declToCoreFn ds
7981
declToCoreFn (A.ValueDecl (ss, com) name _ _ [A.MkUnguarded e]) =
@@ -84,18 +86,29 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
8486

8587
-- Desugars expressions from AST to CoreFn representation.
8688
exprToCoreFn :: SourceSpan -> [Comment] -> Maybe SourceType -> A.Expr -> Expr Ann
87-
exprToCoreFn _ com ty (A.Literal ss lit) =
88-
Literal (ss, com, ty, Nothing) (fmap (exprToCoreFn ss com Nothing) lit)
89-
exprToCoreFn ss com ty (A.Accessor name v) =
90-
Accessor (ss, com, ty, Nothing) name (exprToCoreFn ss [] Nothing v)
89+
exprToCoreFn _ com _ (A.Literal ss lit) =
90+
Literal (ss, com, Nothing) (fmap (exprToCoreFn ss com Nothing) lit)
91+
exprToCoreFn ss com _ (A.Accessor name v) =
92+
Accessor (ss, com, Nothing) name (exprToCoreFn ss [] Nothing v)
9193
exprToCoreFn ss com ty (A.ObjectUpdate obj vs) =
92-
ObjectUpdate (ss, com, ty, Nothing) (exprToCoreFn ss [] Nothing obj) $ fmap (second (exprToCoreFn ss [] Nothing)) vs
93-
exprToCoreFn ss com ty (A.Abs (A.VarBinder _ name) v) =
94-
Abs (ss, com, ty, Nothing) name (exprToCoreFn ss [] Nothing v)
94+
ObjectUpdate (ss, com, Nothing) (exprToCoreFn ss [] Nothing obj) (ty >>= unchangedRecordFields (fmap fst vs)) $ fmap (second (exprToCoreFn ss [] Nothing)) vs
95+
where
96+
-- Return the unchanged labels of a closed record, or Nothing for other types or open records.
97+
unchangedRecordFields :: [PSString] -> Type a -> Maybe [PSString]
98+
unchangedRecordFields updated (TypeApp _ (TypeConstructor _ C.Record) row) =
99+
collect row
100+
where
101+
collect :: Type a -> Maybe [PSString]
102+
collect (REmptyKinded _ _) = Just []
103+
collect (RCons _ (Label l) _ r) = (if l `elem` updated then id else (l :)) <$> collect r
104+
collect _ = Nothing
105+
unchangedRecordFields _ _ = Nothing
106+
exprToCoreFn ss com _ (A.Abs (A.VarBinder _ name) v) =
107+
Abs (ss, com, Nothing) name (exprToCoreFn ss [] Nothing v)
95108
exprToCoreFn _ _ _ (A.Abs _ _) =
96109
internalError "Abs with Binder argument was not desugared before exprToCoreFn mn"
97-
exprToCoreFn ss com ty (A.App v1 v2) =
98-
App (ss, com, ty, (isDictCtor v1 || isSynthetic v2) `orEmpty` IsSyntheticApp) v1' v2'
110+
exprToCoreFn ss com _ (A.App v1 v2) =
111+
App (ss, com, (isDictCtor v1 || isSynthetic v2) `orEmpty` IsSyntheticApp) v1' v2'
99112
where
100113
v1' = exprToCoreFn ss [] Nothing v1
101114
v2' = exprToCoreFn ss [] Nothing v2
@@ -108,24 +121,24 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
108121
A.Var NullSourceSpan _ -> True
109122
A.Unused{} -> True
110123
_ -> False
111-
exprToCoreFn ss com ty (A.Unused _) =
112-
Var (ss, com, ty, Nothing) C.I_undefined
113-
exprToCoreFn _ com ty (A.Var ss ident) =
114-
Var (ss, com, ty, getValueMeta ident) ident
115-
exprToCoreFn ss com ty (A.IfThenElse v1 v2 v3) =
116-
Case (ss, com, ty, Nothing) [exprToCoreFn ss [] Nothing v1]
124+
exprToCoreFn ss com _ (A.Unused _) =
125+
Var (ss, com, Nothing) C.I_undefined
126+
exprToCoreFn _ com _ (A.Var ss ident) =
127+
Var (ss, com, getValueMeta ident) ident
128+
exprToCoreFn ss com _ (A.IfThenElse v1 v2 v3) =
129+
Case (ss, com, Nothing) [exprToCoreFn ss [] Nothing v1]
117130
[ CaseAlternative [LiteralBinder (ssAnn ss) $ BooleanLiteral True]
118131
(Right $ exprToCoreFn ss [] Nothing v2)
119132
, CaseAlternative [NullBinder (ssAnn ss)]
120133
(Right $ exprToCoreFn ss [] Nothing v3) ]
121-
exprToCoreFn _ com ty (A.Constructor ss name) =
122-
Var (ss, com, ty, Just $ getConstructorMeta name) $ fmap properToIdent name
123-
exprToCoreFn ss com ty (A.Case vs alts) =
124-
Case (ss, com, ty, Nothing) (fmap (exprToCoreFn ss [] Nothing) vs) (fmap (altToCoreFn ss) alts)
134+
exprToCoreFn _ com _ (A.Constructor ss name) =
135+
Var (ss, com, Just $ getConstructorMeta name) $ fmap properToIdent name
136+
exprToCoreFn ss com _ (A.Case vs alts) =
137+
Case (ss, com, Nothing) (fmap (exprToCoreFn ss [] Nothing) vs) (fmap (altToCoreFn ss) alts)
125138
exprToCoreFn ss com _ (A.TypedValue _ v ty) =
126139
exprToCoreFn ss com (Just ty) v
127-
exprToCoreFn ss com ty (A.Let w ds v) =
128-
Let (ss, com, ty, getLetMeta w) (concatMap declToCoreFn ds) (exprToCoreFn ss [] Nothing v)
140+
exprToCoreFn ss com _ (A.Let w ds v) =
141+
Let (ss, com, getLetMeta w) (concatMap declToCoreFn ds) (exprToCoreFn ss [] Nothing v)
129142
exprToCoreFn _ com ty (A.PositionedValue ss com1 v) =
130143
exprToCoreFn ss (com ++ com1) ty v
131144
exprToCoreFn _ _ _ e =
@@ -150,16 +163,16 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
150163
-- Desugars case binders from AST to CoreFn representation.
151164
binderToCoreFn :: SourceSpan -> [Comment] -> A.Binder -> Binder Ann
152165
binderToCoreFn _ com (A.LiteralBinder ss lit) =
153-
LiteralBinder (ss, com, Nothing, Nothing) (fmap (binderToCoreFn ss com) lit)
166+
LiteralBinder (ss, com, Nothing) (fmap (binderToCoreFn ss com) lit)
154167
binderToCoreFn ss com A.NullBinder =
155-
NullBinder (ss, com, Nothing, Nothing)
168+
NullBinder (ss, com, Nothing)
156169
binderToCoreFn _ com (A.VarBinder ss name) =
157-
VarBinder (ss, com, Nothing, Nothing) name
170+
VarBinder (ss, com, Nothing) name
158171
binderToCoreFn _ com (A.ConstructorBinder ss dctor@(Qualified mn' _) bs) =
159172
let (_, tctor, _, _) = lookupConstructor env dctor
160-
in ConstructorBinder (ss, com, Nothing, Just $ getConstructorMeta dctor) (Qualified mn' tctor) dctor (fmap (binderToCoreFn ss []) bs)
173+
in ConstructorBinder (ss, com, Just $ getConstructorMeta dctor) (Qualified mn' tctor) dctor (fmap (binderToCoreFn ss []) bs)
161174
binderToCoreFn _ com (A.NamedBinder ss name b) =
162-
NamedBinder (ss, com, Nothing, Nothing) name (binderToCoreFn ss [] b)
175+
NamedBinder (ss, com, Nothing) name (binderToCoreFn ss [] b)
163176
binderToCoreFn _ com (A.PositionedBinder ss com1 b) =
164177
binderToCoreFn ss (com ++ com1) b
165178
binderToCoreFn ss com (A.TypedBinder _ b) =
@@ -232,7 +245,7 @@ findQualModules decls =
232245

233246
-- | Desugars import declarations from AST to CoreFn representation.
234247
importToCoreFn :: A.Declaration -> Maybe (Ann, ModuleName)
235-
importToCoreFn (A.ImportDeclaration (ss, com) name _ _) = Just ((ss, com, Nothing, Nothing), name)
248+
importToCoreFn (A.ImportDeclaration (ss, com) name _ _) = Just ((ss, com, Nothing), name)
236249
importToCoreFn _ = Nothing
237250

238251
-- | Desugars foreign declarations from AST to CoreFn representation.

‎src/Language/PureScript/CoreFn/Expr.hs‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ data Expr a
2929
--
3030
| Accessor a PSString (Expr a)
3131
-- |
32-
-- Partial record update
32+
-- Partial record update (original value, fields to copy (if known), fields to update)
3333
--
34-
| ObjectUpdate a (Expr a) [(PSString, Expr a)]
34+
| ObjectUpdate a (Expr a) (Maybe [PSString]) [(PSString, Expr a)]
3535
-- |
3636
-- Function introduction
3737
--
@@ -99,7 +99,7 @@ extractAnn :: Expr a -> a
9999
extractAnn (Literal a _) = a
100100
extractAnn (Constructor a _ _ _) = a
101101
extractAnn (Accessor a _ _) = a
102-
extractAnn (ObjectUpdate a _ _) = a
102+
extractAnn (ObjectUpdate a _ _ _) = a
103103
extractAnn (Abs a _ _) = a
104104
extractAnn (App a _ _) = a
105105
extractAnn (Var a _) = a
@@ -111,12 +111,12 @@ extractAnn (Let a _ _) = a
111111
-- Modify the annotation on a term
112112
--
113113
modifyAnn :: (a -> a) -> Expr a -> Expr a
114-
modifyAnn f (Literal a b) = Literal (f a) b
115-
modifyAnn f (Constructor a b c d) = Constructor (f a) b c d
116-
modifyAnn f (Accessor a b c) = Accessor (f a) b c
117-
modifyAnn f (ObjectUpdate a b c) = ObjectUpdate (f a) b c
118-
modifyAnn f (Abs a b c) = Abs (f a) b c
119-
modifyAnn f (App a b c) = App (f a) b c
120-
modifyAnn f (Var a b) = Var (f a) b
121-
modifyAnn f (Case a b c) = Case (f a) b c
122-
modifyAnn f (Let a b c) = Let (f a) b c
114+
modifyAnn f (Literal a b) = Literal (f a) b
115+
modifyAnn f (Constructor a b c d) = Constructor (f a) b c d
116+
modifyAnn f (Accessor a b c) = Accessor (f a) b c
117+
modifyAnn f (ObjectUpdate a b c d) = ObjectUpdate (f a) b c d
118+
modifyAnn f (Abs a b c) = Abs (f a) b c
119+
modifyAnn f (App a b c) = App (f a) b c
120+
modifyAnn f (Var a b) = Var (f a) b
121+
modifyAnn f (Case a b c) = Case (f a) b c
122+
modifyAnn f (Let a b c) = Let (f a) b c

‎src/Language/PureScript/CoreFn/FromJSON.hs‎

Lines changed: 3 additions & 2 deletions

0 commit comments

Comments
 (0)