git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix isNullaryConstructor check
commit7050984c130885c9c73cdca9427d9effcc638c82 authorGary Burgess <gary.burgess@gmail.com> dateFri 18 Jul 2014, 21:06 (12 years ago) parenta1b6402
1 file changed+6−3
src/Language/PureScript/CodeGen/JS.hs+6−3
src/Language/PureScript/CodeGen/JS.hs+6−3
@@ -399,6 +399,9 @@ isOnlyConstructor e ctor =
399399
400400isNullaryConstructor :: Environment -> Qualified ProperName -> Bool
401401isNullaryConstructor e ctor =
402− case fromMaybe (error "Data constructor not found") $ ctor `M.lookup` dataConstructors e of
403− (_, TypeConstructor{}) -> True
404− _ -> False
402+ not . isFunction . snd . fromMaybe (error "Data constructor not found") $ ctor `M.lookup` dataConstructors e
403+ where
404+ isFunction :: Type -> Bool
405+ isFunction (ForAll _ t _) = isFunction t
406+ isFunction (TypeApp t _) = isFunction t
407+ isFunction t = t == tyFunction