git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Use unit over {}
8b58631Gary Burgess
src/Language/PureScript/CodeGen/JS/AST.hs+3−1
@@ -19,6 +19,8 @@ module Language.PureScript.CodeGen.JS.AST where
19
19
20import Data.Data
20import Data.Data
21
21
22+import qualified Language.PureScript.Constants as C
23+
22-- |
24-- |
23-- Built-in unary operators
25-- Built-in unary operators
24--
26--
@@ -246,7 +248,7 @@ data JS
246-- Javascript representation of the unit value.
248-- Javascript representation of the unit value.
247--
249--
248jsUnit :: JS
250jsUnit :: JS
249−jsUnit = JSObjectLiteral []
251+jsUnit = JSAccessor C.unit (JSVar C.prelude)
250
252
251--
253--
252-- Traversals
254-- Traversals
src/Language/PureScript/Constants.hs+3
@@ -153,6 +153,9 @@ mkFn = "mkFn"
153runFn :: String
153runFn :: String
154runFn = "runFn"
154runFn = "runFn"
155
155
156+unit :: String
157+unit = "unit"
158+
156-- Type Class Dictionary Names
159-- Type Class Dictionary Names
157
160
158monadEffDictionary :: String
161monadEffDictionary :: String
src/Language/PureScript/TypeChecker/Types.hs+5−2
@@ -357,12 +357,12 @@ entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filt
357 -- Turn a DictionaryValue into a Expr
357 -- Turn a DictionaryValue into a Expr
358 dictionaryValueToValue :: DictionaryValue -> Expr
358 dictionaryValueToValue :: DictionaryValue -> Expr
359 dictionaryValueToValue (LocalDictionaryValue fnName) = Var fnName
359 dictionaryValueToValue (LocalDictionaryValue fnName) = Var fnName
360− dictionaryValueToValue (GlobalDictionaryValue fnName) = App (Var fnName) (ObjectLiteral [])
360+ dictionaryValueToValue (GlobalDictionaryValue fnName) = App (Var fnName) valUnit
361 dictionaryValueToValue (DependentDictionaryValue fnName dicts) = foldl App (Var fnName) (map dictionaryValueToValue dicts)
361 dictionaryValueToValue (DependentDictionaryValue fnName dicts) = foldl App (Var fnName) (map dictionaryValueToValue dicts)
362 dictionaryValueToValue (SubclassDictionaryValue dict superclassName index) =
362 dictionaryValueToValue (SubclassDictionaryValue dict superclassName index) =
363 App (Accessor (C.__superclass_ ++ show superclassName ++ "_" ++ show index)
363 App (Accessor (C.__superclass_ ++ show superclassName ++ "_" ++ show index)
364 (dictionaryValueToValue dict))
364 (dictionaryValueToValue dict))
365− (ObjectLiteral [])
365+ valUnit
366 -- Ensure that a substitution is valid
366 -- Ensure that a substitution is valid
367 verifySubstitution :: [(String, Type)] -> Maybe [(String, Type)]
367 verifySubstitution :: [(String, Type)] -> Maybe [(String, Type)]
368 verifySubstitution subst = do
368 verifySubstitution subst = do
@@ -393,6 +393,9 @@ entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filt
393 dictTrace (SubclassDictionaryValue dict _ _) = dictTrace dict
393 dictTrace (SubclassDictionaryValue dict _ _) = dictTrace dict
394 dictTrace other = other
394 dictTrace other = other
395
395
396+ valUnit :: Expr
397+ valUnit = Var (Qualified (Just (ModuleName [ProperName C.prelude])) (Ident C.unit))
398+
396-- |
399-- |
397-- Check all values in a list pairwise match a predicate
400-- Check all values in a list pairwise match a predicate
398--
401--