@@ -244,23 +244,23 @@ moduleToJs (Module coms mn imps exps foreigns decls) foreign_ =
244244 ret <- valueToJs val
245245 return $ JSApp Nothing (JSFunction Nothing Nothing [] (JSBlock Nothing (ds' ++ [JSReturn Nothing ret]))) []
246246 valueToJs' (Constructor (_, _, _, Just IsNewtype) _ (ProperName ctor) _) =
247− return $ JSVariableIntroduction Nothing ctor (Just $
247+ return $ JSVariableIntroduction Nothing (properToJs ctor) (Just $
248248 JSObjectLiteral Nothing [("create",
249249 JSFunction Nothing Nothing ["value"]
250250 (JSBlock Nothing [JSReturn Nothing $ JSVar Nothing "value"]))])
251251 valueToJs' (Constructor _ _ (ProperName ctor) []) =
252− return $ iife ctor [ JSFunction Nothing (Just ctor) [] (JSBlock Nothing [])
253− , JSAssignment Nothing (JSAccessor Nothing "value" (JSVar Nothing ctor))
254− (JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing ctor) []) ]
252+ return $ iife (properToJs ctor) [ JSFunction Nothing (Just (properToJs ctor)) [] (JSBlock Nothing [])
253+ , JSAssignment Nothing (JSAccessor Nothing "value" (JSVar Nothing (properToJs ctor)))
254+ (JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing (properToJs ctor)) []) ]
255255 valueToJs' (Constructor _ _ (ProperName ctor) fields) =
256256 let constructor =
257257 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)
259259 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)
261261 in foldr (\f inner -> JSFunction Nothing Nothing [identToJs f] (JSBlock Nothing [JSReturn Nothing inner])) body fields
262− in return $ iife ctor [ constructor
263− , JSAssignment Nothing (JSAccessor Nothing "create" (JSVar Nothing ctor)) createFn
262+ in return $ iife (properToJs ctor) [ constructor
263+ , JSAssignment Nothing (JSAccessor Nothing "create" (JSVar Nothing (properToJs ctor))) createFn
264264 ]
265265
266266 iife :: String -> [JS] -> JS