@@ -244,23 +244,23 @@ moduleToJs (Module coms mn imps exps foreigns decls) foreign_ =
244 ret <- valueToJs val
244 ret <- valueToJs val
245 return $ JSApp Nothing (JSFunction Nothing Nothing [] (JSBlock Nothing (ds' ++ [JSReturn Nothing ret]))) []
245 return $ JSApp Nothing (JSFunction Nothing Nothing [] (JSBlock Nothing (ds' ++ [JSReturn Nothing ret]))) []
246 valueToJs' (Constructor (_, _, _, Just IsNewtype) _ (ProperName ctor) _) =
246 valueToJs' (Constructor (_, _, _, Just IsNewtype) _ (ProperName ctor) _) =
247− return $ JSVariableIntroduction Nothing ctor (Just $
247+ return $ JSVariableIntroduction Nothing (properToJs ctor) (Just $
248 JSObjectLiteral Nothing [("create",
248 JSObjectLiteral Nothing [("create",
249 JSFunction Nothing Nothing ["value"]
249 JSFunction Nothing Nothing ["value"]
250 (JSBlock Nothing [JSReturn Nothing $ JSVar Nothing "value"]))])
250 (JSBlock Nothing [JSReturn Nothing $ JSVar Nothing "value"]))])
251 valueToJs' (Constructor _ _ (ProperName ctor) []) =
251 valueToJs' (Constructor _ _ (ProperName ctor) []) =
252− return $ iife ctor [ JSFunction Nothing (Just ctor) [] (JSBlock Nothing [])
252+ return $ iife (properToJs ctor) [ JSFunction Nothing (Just (properToJs ctor)) [] (JSBlock Nothing [])
253− , JSAssignment Nothing (JSAccessor Nothing "value" (JSVar Nothing ctor))
253+ , JSAssignment Nothing (JSAccessor Nothing "value" (JSVar Nothing (properToJs ctor)))
254− (JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing ctor) []) ]
254+ (JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing (properToJs ctor)) []) ]
255 valueToJs' (Constructor _ _ (ProperName ctor) fields) =
255 valueToJs' (Constructor _ _ (ProperName ctor) fields) =
256 let constructor =
256 let constructor =
257 let body = [ JSAssignment Nothing (JSAccessor Nothing (identToJs f) (JSVar Nothing "this")) (var f) | f <- fields ]
257 let body = [ JSAssignment Nothing (JSAccessor Nothing (identToJs f) (JSVar Nothing "this")) (var f) | f <- fields ]
258− in JSFunction Nothing (Just ctor) (identToJs `map` fields) (JSBlock Nothing body)
258+ in JSFunction Nothing (Just (properToJs ctor)) (identToJs `map` fields) (JSBlock Nothing body)
259 createFn =
259 createFn =
260− let body = JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing ctor) (var `map` fields)
260+ let body = JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing (properToJs ctor)) (var `map` fields)
261 in foldr (\f inner -> JSFunction Nothing Nothing [identToJs f] (JSBlock Nothing [JSReturn Nothing inner])) body fields
261 in foldr (\f inner -> JSFunction Nothing Nothing [identToJs f] (JSBlock Nothing [JSReturn Nothing inner])) body fields
262− in return $ iife ctor [ constructor
262+ in return $ iife (properToJs ctor) [ constructor
263− , JSAssignment Nothing (JSAccessor Nothing "create" (JSVar Nothing ctor)) createFn
263+ , JSAssignment Nothing (JSAccessor Nothing "create" (JSVar Nothing (properToJs ctor))) createFn
266 iife :: String -> [JS] -> JS
266 iife :: String -> [JS] -> JS