git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Use unit over {}
commit8b58631568933f71d43c6f124f4afee71969ec1e authorGary Burgess <gary.burgess@gmail.com> dateMon 11 Aug 2014, 19:01 (12 years ago) parent53f67be
3 files changed+11−3
src/Language/PureScript/CodeGen/JS/AST.hs+3−1 src/Language/PureScript/Constants.hs+3 src/Language/PureScript/TypeChecker/Types.hs+5−2
src/Language/PureScript/CodeGen/JS/AST.hs+3−1
@@ -19,6 +19,8 @@ module Language.PureScript.CodeGen.JS.AST where
1919
2020import Data.Data
2121
22+import qualified Language.PureScript.Constants as C
23+
2224-- |
2325-- Built-in unary operators
2426--
@@ -246,7 +248,7 @@ data JS
246248-- Javascript representation of the unit value.
247249--
248250jsUnit :: JS
249−jsUnit = JSObjectLiteral []
251+jsUnit = JSAccessor C.unit (JSVar C.prelude)
250252
251253--
252254-- Traversals
src/Language/PureScript/Constants.hs+3
@@ -153,6 +153,9 @@ mkFn = "mkFn"
153153runFn :: String
154154runFn = "runFn"
155155
156+unit :: String
157+unit = "unit"
158+
156159-- Type Class Dictionary Names
157160
158161monadEffDictionary :: String
src/Language/PureScript/TypeChecker/Types.hs+5−2
@@ -357,12 +357,12 @@ entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filt
357357 -- Turn a DictionaryValue into a Expr
358358 dictionaryValueToValue :: DictionaryValue -> Expr
359359 dictionaryValueToValue (LocalDictionaryValue fnName) = Var fnName
360− dictionaryValueToValue (GlobalDictionaryValue fnName) = App (Var fnName) (ObjectLiteral [])
360+ dictionaryValueToValue (GlobalDictionaryValue fnName) = App (Var fnName) valUnit
361361 dictionaryValueToValue (DependentDictionaryValue fnName dicts) = foldl App (Var fnName) (map dictionaryValueToValue dicts)
362362 dictionaryValueToValue (SubclassDictionaryValue dict superclassName index) =
363363 App (Accessor (C.__superclass_ ++ show superclassName ++ "_" ++ show index)
364364 (dictionaryValueToValue dict))
365− (ObjectLiteral [])
365+ valUnit
366366 -- Ensure that a substitution is valid
367367 verifySubstitution :: [(String, Type)] -> Maybe [(String, Type)]
368368 verifySubstitution subst = do
@@ -393,6 +393,9 @@ entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filt
393393 dictTrace (SubclassDictionaryValue dict _ _) = dictTrace dict
394394 dictTrace other = other
395395
396+ valUnit :: Expr
397+ valUnit = Var (Qualified (Just (ModuleName [ProperName C.prelude])) (Ident C.unit))
398+
396399-- |
397400-- Check all values in a list pairwise match a predicate
398401--