@@ -70,7 +70,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
7070 delete (ModuleName [ProperName C.prim]) . (\\ [mn]) $
7171 (snd <$> imps)
7272 let cppImports' = "PureScript" : cppImports
73− cppDecls <- concat <$> mapM (bindToCpp [CppTopLevel]) decls
73+ cppDecls <- concat <$> mapM (bindToCpp [TopLevel]) decls
7474 let cpps = filterInlineFuncs <$> cppDecls
7575 namesmap = M.toList .
7676 M.mapKeysMonotonic (qualifiedToCpp id) . M.map (\(t, _, _) -> arity t) $
@@ -119,16 +119,16 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
119119 -- Generate code in the simplified C++1x intermediate representation for a declaration
120120 --
121121 -------------------------------------------------------------------------------------------------
122− bindToCpp :: [CppValueQual] -> Bind Ann -> m [Cpp]
122+ bindToCpp :: [ValueQual] -> Bind Ann -> m [Cpp]
123123 -------------------------------------------------------------------------------------------------
124124 bindToCpp qs (NonRec ann ident val) = return <$> declToCpp qs (ann, ident) val
125− bindToCpp qs (Rec vals) = forM vals (uncurry $ declToCpp (CppRecursive:qs))
125+ bindToCpp qs (Rec vals) = forM vals (uncurry $ declToCpp (Recursive:qs))
126126
127127 -- |
128128 -- Desugar a declaration into a variable introduction or named function
129129 -- declaration.
130130 -------------------------------------------------------------------------------------------------
131− declToCpp :: [CppValueQual] -> (Ann, Ident) -> Expr Ann -> m Cpp
131+ declToCpp :: [ValueQual] -> (Ann, Ident) -> Expr Ann -> m Cpp
132132 -------------------------------------------------------------------------------------------------
133133 declToCpp _ (_, ident) e@(Abs (_, _, _, Just IsTypeClassConstructor) _ _) =
134134 let className = identToCpp ident
@@ -136,7 +136,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
136136 in return $ CppStruct className [CppEnum Nothing Nothing (sort supers ++ members)]
137137
138138 declToCpp vqs (_, ident) (Abs (_, com, ty, _) arg body) = do
139− fn <- if CppTopLevel `elem` vqs
139+ fn <- if TopLevel `elem` vqs
140140 then do
141141 argNames <- replicateM (arity' - length args' - 1) freshName
142142 let args'' = zip argNames (repeat aty)
@@ -154,13 +154,13 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
154154 name
155155 (arg' : args' ++ args'')
156156 rty
157− (vqs ++ if isAccessor (snd abs') then [CppInline] else [])
157+ (vqs ++ if isAccessor (snd abs') then [Inline] else [])
158158 (convertNestedLambdas $ convertDictIndexers block)
159159 , CppFunction
160160 (curriedName name)
161161 [arg']
162162 rty
163− (if arity' == 1 then [CppInline] else [])
163+ (if arity' == 1 then [Inline] else [])
164164 (asReturnBlock $
165165 curriedLambda
166166 (fst <$> args' ++ args'')
@@ -173,7 +173,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
173173 name
174174 [arg']
175175 rty
176− (vqs ++ if isIndexer block then [CppInline] else [])
176+ (vqs ++ if isIndexer block then [Inline] else [])
177177 (convertNestedLambdas . asReturnBlock $ convertDictIndexers block)
178178 return (CppComment com $ convertIfPrimFn ty' fn)
179179 where
@@ -182,8 +182,8 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
182182 | otherwise = Nothing
183183 arity' = maybe 0 arity ty'
184184 name = identToCpp ident
185− aty = Just $ CppAny [CppConst, CppRef]
186− rty = Just $ CppAny []
185+ aty = Just $ Any [Const, Ref]
186+ rty = Just $ Any []
187187 arg' = (identToCpp arg, aty)
188188 args' = (\i -> (identToCpp i, aty)) <$> fst abs'
189189 abs' = unAbs body []
@@ -203,8 +203,8 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
203203 CppFunction
204204 (identToCpp ident)
205205 []
206− (Just $ CppAny [])
207− [CppInline]
206+ (Just $ Any [])
207+ [Inline]
208208 (asReturnBlock $
209209 CppDataLiteral [CppAccessor (CppVar $ identToCpp ident) (CppVar "data")])
210210
@@ -213,8 +213,8 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
213213 [ CppFunction
214214 name
215215 (farg <$> fields')
216− (Just $ CppAny [])
217− [CppInline]
216+ (Just $ Any [])
217+ [Inline]
218218 (asReturnBlock $
219219 CppDataLiteral $
220220 CppAccessor (CppVar name) (CppVar "data") : (CppVar <$> fields'))
@@ -224,8 +224,8 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
224224 [ CppFunction
225225 (curriedName name)
226226 (farg <$> f)
227− (Just $ CppAny [])
228− (if length fields == 1 then [CppInline] else [])
227+ (Just $ Any [])
228+ (if length fields == 1 then [Inline] else [])
229229 (CppBlock (fieldLambdas fs))
230230 ]
231231 else
@@ -235,19 +235,19 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
235235 fields' = identToCpp <$> fields
236236 (f, fs) | (f' : fs') <- fields' = ([f'], fs')
237237 | otherwise = ([], [])
238− farg = \x -> (x, Just $ CppAny [CppConst, CppRef])
238+ farg = \x -> (x, Just $ Any [Const, Ref])
239239 fieldLambdas flds
240240 | (f' : fs') <- flds = [ CppReturn . maybeRemCaps $
241241 CppLambda
242− [CppCaptureAll]
242+ [CaptureAll]
243243 (farg <$> [f'])
244− (Just $ CppAny [])
244+ (Just $ Any [])
245245 (CppBlock $ fieldLambdas fs') ]
246246 | otherwise = [CppReturn $ CppApp (CppVar name) (CppVar <$> fields')]
247247
248248 declToCpp qs (_, ident) e
249249 | Just ty <- exprType e,
250− CppTopLevel `elem` qs,
250+ TopLevel `elem` qs,
251251 arity' <- arity ty,
252252 arity' > 0 = do
253253 argNames <- replicateM arity' freshName
@@ -257,7 +257,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
257257 (App nullAnn e (Var nullAnn . Qualified Nothing . Ident $ head argNames))
258258 let fn' = CppFunction
259259 (curriedName name)
260− [(head argNames, Just $ CppAny [CppConst, CppRef])]
260+ [(head argNames, Just $ Any [Const, Ref])]
261261 rty
262262 []
263263 (asReturnBlock $
@@ -277,14 +277,14 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
277277 else []
278278 where
279279 name = identToCpp ident
280− aty = Just $ CppAny [CppConst, CppRef]
281− rty = Just $ CppAny []
280+ aty = Just $ Any [Const, Ref]
281+ rty = Just $ Any []
282282
283283 declToCpp qs (_, ident) val = do
284284 val' <- valueToCpp val
285285 return $
286286 CppVariableIntroduction
287− (identToCpp ident, Just $ CppAny [CppConst])
287+ (identToCpp ident, Just $ Any [Const])
288288 qs
289289 (Just val')
290290
@@ -302,12 +302,12 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
302302 -------------------------------------------------------------------------------------------------
303303 fnToLambda (CppFunction name args _ qs body) =
304304 CppVariableIntroduction
305− (name, Just $ CppAny [CppConst])
306− (filter (==CppStatic) qs)
307− (Just $ CppLambda cs args (Just $ CppAny []) body)
305+ (name, Just $ Any [Const])
306+ (filter (==Static) qs)
307+ (Just $ CppLambda cs args (Just $ Any []) body)
308308 where
309− cs | (not . null) (qs `intersect` [CppInline, CppStatic]) = []
310− | otherwise = [CppCaptureAll]
309+ cs | (not . null) (qs `intersect` [Inline, Static]) = []
310+ | otherwise = [CaptureAll]
311311 fnToLambda (CppComment com cpp) = CppComment com (fnToLambda cpp)
312312 fnToLambda _ = error "Not a function!"
313313
@@ -318,7 +318,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
318318 where
319319 go :: Cpp -> Cpp
320320 go f@(CppFunction {}) = maybeRemCaps $ fnToLambda f
321− go (CppLambda _ args rtyp body) = maybeRemCaps $ CppLambda [CppCaptureAll] args rtyp body
321+ go (CppLambda _ args rtyp body) = maybeRemCaps $ CppLambda [CaptureAll] args rtyp body
322322 go cpp = cpp
323323
324324 -------------------------------------------------------------------------------------------------
@@ -337,13 +337,13 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
337337 filteredFns cpp = filter (\(f,_) -> everythingOnCpp (||) (== CppVar f) cpp) fns
338338
339339 recursive :: Cpp -> [Cpp]
340− recursive cpp'@(CppFunction _ _ _ qs _) | CppRecursive `elem` qs = [cpp']
341− recursive cpp'@(CppVariableIntroduction _ qs _) | CppRecursive `elem` qs = [cpp']
340+ recursive cpp'@(CppFunction _ _ _ qs _) | Recursive `elem` qs = [cpp']
341+ recursive cpp'@(CppVariableIntroduction _ qs _) | Recursive `elem` qs = [cpp']
342342 recursive _ = []
343343
344344 removeRec :: Cpp -> Cpp
345− removeRec (CppFunction _ _ _ qs _) | CppRecursive `elem` qs = CppNoOp
346− removeRec (CppVariableIntroduction _ qs _) | CppRecursive `elem` qs = CppNoOp
345+ removeRec (CppFunction _ _ _ qs _) | Recursive `elem` qs = CppNoOp
346+ removeRec (CppVariableIntroduction _ qs _) | Recursive `elem` qs = CppNoOp
347347 removeRec cpp' = cpp'
348348
349349 replaceVar :: [(String, Cpp)] -> Cpp -> Cpp
@@ -354,7 +354,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
354354
355355 dict :: Cpp
356356 dict = CppVariableIntroduction
357− (topdict, Just $ CppAny [CppConst])
357+ (topdict, Just $ Any [Const])
358358 []
359359 (Just $ CppDataLiteral ((\(f,cpp) -> CppComment [LineComment f] cpp) <$> fns))
360360
@@ -375,14 +375,14 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
375375 accessor :: String -> (String, Cpp) -> Cpp
376376 accessor dictname (name, _) =
377377 CppVariableIntroduction
378− (name, Just $ CppAny [CppConst])
378+ (name, Just $ Any [Const])
379379 []
380380 (Just . snd $ accessed dictname name)
381381
382382 toelem :: Cpp -> (String, Cpp)
383383 toelem (CppFunction name args rtyp _ body'@(CppBlock body)) =
384384 (name, withdict . maybeRemCaps $ CppLambda
385− [CppCaptureAll]
385+ [CaptureAll]
386386 args
387387 rtyp
388388 (CppBlock $ (accessor localdict <$> filteredFns body') ++ body))
@@ -396,9 +396,9 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
396396
397397 withdict :: Cpp -> Cpp
398398 withdict cpp' = maybeRemCaps $ CppLambda
399− [CppCaptureAll]
400− [(localdict, Just $ CppAny [CppConst, CppRef])]
401− (Just $ CppAny [])
399+ [CaptureAll]
400+ [(localdict, Just $ Any [Const, Ref])]
401+ (Just $ Any [])
402402 (asReturnBlock cpp')
403403 topdict :: String
404404 topdict = "_$dict$_"
@@ -442,7 +442,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
442442 CppArrayLiteral <$> mapM valueToCpp xs
443443
444444 valueToCpp (Literal _ (ObjectLiteral ps)) =
445− CppMapLiteral CppRecord <$>
445+ CppMapLiteral Record <$>
446446 mapM (sndM valueToCpp) ((\(k,v) -> (CppSymbol k, v)) <$> sortBy (compare `on` fst) ps)
447447
448448 valueToCpp (Accessor _ prop val) =
@@ -454,7 +454,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
454454 updatedFields <- mapM (sndM valueToCpp) ps
455455 let origKeys = (allKeys ty) \\ (fst <$> updatedFields)
456456 origFields = (\key -> (key, CppIndexer (CppSymbol key) obj')) <$> origKeys
457− return $ CppMapLiteral CppRecord $
457+ return $ CppMapLiteral Record $
458458 (\(k,v) -> (CppSymbol k, v)) <$> sortBy (compare `on` fst) (origFields ++ updatedFields)
459459 where
460460 allKeys :: T.Type -> [String]
@@ -470,8 +470,8 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
470470 return $
471471 CppLambda
472472 []
473− [(identToCpp arg, Just $ CppAny [CppConst, CppRef])]
474− (Just $ CppAny [])
473+ [(identToCpp arg, Just $ Any [Const, Ref])]
474+ (Just $ Any [])
475475 (asReturnBlock $ convertDictIndexers cpp')
476476 where
477477 arg' = identToCpp arg
@@ -487,7 +487,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
487487 Var (_, _, _, Just IsNewtype) _ -> return (head args')
488488 Var (_, _, _, Just IsTypeClassConstructor) (Qualified mn' (Ident classname)) ->
489489 let Just (_, constraints, fns) = findClass (Qualified mn' (ProperName classname)) in
490− return . CppMapLiteral CppInstance $
490+ return . CppMapLiteral Instance $
491491 zip
492492 (CppSymbol <$> (sort $ superClassDictionaryNames constraints) ++ (fst <$> fns))
493493 args'
@@ -563,7 +563,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
563563 (CppLambda
564564 []
565565 []
566− (Just $ CppAny [])
566+ (Just $ Any [])
567567 (CppBlock (assignments ++ concat cpps ++ [failedPatternError valNames])))
568568 []
569569 where
@@ -607,7 +607,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
607607 binderToCpp varName done (VarBinder _ ident) =
608608 return $
609609 CppVariableIntroduction
610− (identToCpp ident, Just $ CppAny [CppConst])
610+ (identToCpp ident, Just $ Any [Const])
611611 []
612612 (Just $ CppVar varName)
613613 : done
@@ -665,7 +665,7 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
665665 cpp <- binderToCpp varName done binder
666666 return $
667667 CppVariableIntroduction
668− (identToCpp ident, Just $ CppAny [CppConst])
668+ (identToCpp ident, Just $ Any [Const])
669669 []
670670 (Just $ CppVar varName)
671671 : cpp
@@ -811,9 +811,9 @@ moduleToCpp env (Module _ mn imps _ foreigns decls) = do
811811 return $
812812 [ CppFunction
813813 (curriedName name)
814− [(head argNames, Just $ CppAny [CppConst, CppRef])]
815− (Just $ CppAny [])
816− (if arity' == 1 then [CppInline] else [])
814+ [(head argNames, Just $ Any [Const, Ref])]
815+ (Just $ Any [])
816+ (if arity' == 1 then [Inline] else [])
817817 (asReturnBlock $
818818 curriedLambda
819819 (tail argNames)
@@ -836,9 +836,9 @@ asReturnBlock cpp = CppBlock [CppReturn cpp]
836836curriedLambda :: [String] -> Cpp -> Cpp
837837---------------------------------------------------------------------------------------------------
838838curriedLambda args ret = foldr (\arg ret' -> CppLambda
839− [CppCaptureAll]
840− [(arg, Just $ CppAny [CppConst, CppRef])]
841− (Just $ CppAny [])
839+ [CaptureAll]
840+ [(arg, Just $ Any [Const, Ref])]
841+ (Just $ Any [])
842842 (asReturnBlock ret')
843843 ) ret args
844844
@@ -947,8 +947,8 @@ filterInlineFuncs = everywhereOnCpp convert
947947 convert :: Cpp -> Cpp
948948 convert (CppBlock []) = CppBlock []
949949 convert (CppFunction n ps r qs cpp)
950− | CppInline `elem` qs,
951− everythingOnCpp (||) shouldRemove cpp = CppFunction n ps r (delete CppInline qs) cpp
950+ | Inline `elem` qs,
951+ everythingOnCpp (||) shouldRemove cpp = CppFunction n ps r (delete Inline qs) cpp
952952 where
953953 shouldRemove :: Cpp -> Bool
954954 shouldRemove CppSymbol{} = True