Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Language/PureScript/AST/Declarations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ unwrapTypeDeclaration td = (tydeclIdent td, tydeclType td)
-- In this example @double@ is the identifier, @x@ is a binder and @x + x@ is the expression.
data ValueDeclarationData a = ValueDeclarationData
{ valdeclSourceAnn :: !SourceAnn
, valdeclPublicName :: !(Maybe Ident)
-- ^ The declared value's name - renders instead of valdeclIdent
, valdeclIdent :: !Ident
-- ^ The declared value's name
, valdeclName :: !NameKind
Expand All @@ -467,9 +469,9 @@ getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr])
getValueDeclaration (ValueDeclaration d) = Just d
getValueDeclaration _ = Nothing

pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration
pattern ValueDecl sann ident name binders expr
= ValueDeclaration (ValueDeclarationData sann ident name binders expr)
pattern ValueDecl :: SourceAnn -> Maybe Ident -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration
pattern ValueDecl sann publicName ident name binders expr
= ValueDeclaration (ValueDeclarationData sann publicName ident name binders expr)

-- |
-- The data type of declarations
Expand Down
18 changes: 9 additions & 9 deletions src/Language/PureScript/AST/Traversals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ everywhereOnValues f g h = (f', g', h')
where
f' :: Declaration -> Declaration
f' (DataBindingGroupDeclaration ds) = f (DataBindingGroupDeclaration (fmap f' ds))
f' (ValueDecl sa name nameKind bs val) =
f (ValueDecl sa name nameKind (fmap h' bs) (fmap (mapGuardedExpr handleGuard g') val))
f' (ValueDecl sa publicName name nameKind bs val) =
f (ValueDecl sa publicName name nameKind (fmap h' bs) (fmap (mapGuardedExpr handleGuard g') val))
f' (BoundValueDeclaration sa b expr) = f (BoundValueDeclaration sa (h' b) (g' expr))
f' (BindingGroupDeclaration ds) = f (BindingGroupDeclaration (fmap (\(name, nameKind, val) -> (name, nameKind, g' val)) ds))
f' (TypeClassDeclaration sa name args implies deps ds) = f (TypeClassDeclaration sa name args implies deps (fmap f' ds))
Expand Down Expand Up @@ -127,8 +127,8 @@ everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)

f' :: Declaration -> m Declaration
f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f' <=< f) ds
f' (ValueDecl sa name nameKind bs val) =
ValueDecl sa name nameKind <$> traverse (h' <=< h) bs <*> traverse (guardedExprM handleGuard (g' <=< g)) val
f' (ValueDecl sa publicName name nameKind bs val) =
ValueDecl sa publicName name nameKind <$> traverse (h' <=< h) bs <*> traverse (guardedExprM handleGuard (g' <=< g)) val
f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (,,) name nameKind <$> (g val >>= g')) ds
f' (TypeClassDeclaration sa name args implies deps ds) = TypeClassDeclaration sa name args implies deps <$> traverse (f' <=< f) ds
f' (TypeInstanceDeclaration sa ch idx name cs className args ds) = TypeInstanceDeclaration sa ch idx name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds
Expand Down Expand Up @@ -196,8 +196,8 @@ everywhereOnValuesM f g h = (f', g', h')

f' :: Declaration -> m Declaration
f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> traverse f' ds) >>= f
f' (ValueDecl sa name nameKind bs val) =
ValueDecl sa name nameKind <$> traverse h' bs <*> traverse (guardedExprM handleGuard g') val >>= f
f' (ValueDecl sa publicName name nameKind bs val) =
ValueDecl sa publicName name nameKind <$> traverse h' bs <*> traverse (guardedExprM handleGuard g') val >>= f
f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (,,) name nameKind <$> g' val) ds) >>= f
f' (BoundValueDeclaration sa b expr) = (BoundValueDeclaration sa <$> h' b <*> g' expr) >>= f
f' (TypeClassDeclaration sa name args implies deps ds) = (TypeClassDeclaration sa name args implies deps <$> traverse f' ds) >>= f
Expand Down Expand Up @@ -434,8 +434,8 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
f'' s = uncurry f' <=< f s

f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f'' s) ds
f' s (ValueDecl sa name nameKind bs val) =
ValueDecl sa name nameKind <$> traverse (h'' s) bs <*> traverse (guardedExprM (k' s) (g'' s)) val
f' s (ValueDecl sa publicName name nameKind bs val) =
ValueDecl sa publicName name nameKind <$> traverse (h'' s) bs <*> traverse (guardedExprM (k' s) (g'' s)) val
f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (thirdM (g'' s)) ds
f' s (TypeClassDeclaration sa name args implies deps ds) = TypeClassDeclaration sa name args implies deps <$> traverse (f'' s) ds
f' s (TypeInstanceDeclaration sa ch idx name cs className args ds) = TypeInstanceDeclaration sa ch idx name cs className args <$> traverseTypeInstanceBody (traverse (f'' s)) ds
Expand Down Expand Up @@ -521,7 +521,7 @@ everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s)
f' s (DataBindingGroupDeclaration ds) =
let s' = S.union s (S.fromList (map ToplevelIdent (mapMaybe getDeclIdent (NEL.toList ds))))
in foldMap (f'' s') ds
f' s (ValueDecl _ name _ bs val) =
f' s (ValueDecl _ _ name _ bs val) =
let s' = S.insert (ToplevelIdent name) s
s'' = S.union s' (S.fromList (concatMap localBinderNames bs))
in foldMap (h'' s') bs <> foldMap (l' s'') val
Expand Down
10 changes: 8 additions & 2 deletions src/Language/PureScript/CoreFn/Desugar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
in NonRec (ssA ss) (properToIdent ctor) $ Constructor (ss, com, Nothing, Nothing) tyName ctor fields
declToCoreFn (A.DataBindingGroupDeclaration ds) =
concatMap declToCoreFn ds
declToCoreFn (A.ValueDecl (ss, com) name _ _ [A.MkUnguarded e]) =
declToCoreFn (A.ValueDecl (ss, com) _ name _ _ [A.MkUnguarded e]) =
[NonRec (ssA ss) name (exprToCoreFn ss com Nothing e)]
declToCoreFn (A.BindingGroupDeclaration ds) =
[Rec . NEL.toList $ fmap (\(((ss, com), name), _, e) -> ((ssA ss, name), exprToCoreFn ss com Nothing e)) ds]
Expand Down Expand Up @@ -101,12 +101,18 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
exprToCoreFn ss com (Just ty) v
exprToCoreFn ss com ty (A.Let w ds v) =
Let (ss, com, ty, getLetMeta w) (concatMap declToCoreFn ds) (exprToCoreFn ss [] Nothing v)
exprToCoreFn ss com ty (A.TypeClassDictionaryConstructorApp name (A.TypedValue _ lit@(A.Literal _ (A.ObjectLiteral _)) _)) =
exprToCoreFn ss com ty (A.TypeClassDictionaryConstructorApp name (A.TypedValue _ lit _)) =
exprToCoreFn ss com ty (A.TypeClassDictionaryConstructorApp name lit)
exprToCoreFn ss com _ (A.TypeClassDictionaryConstructorApp name (A.Literal _ (A.ObjectLiteral vs))) =
let args = fmap (exprToCoreFn ss [] Nothing . snd) $ sortBy (compare `on` fst) vs
ctor = Var (ss, [], Nothing, Just IsTypeClassConstructor) (fmap properToIdent name)
in foldl (App (ss, com, Nothing, Nothing)) ctor args
exprToCoreFn ss com _ (A.TypeClassDictionaryConstructorApp name (A.Let _ ds _)) =
let memberCoreFn (A.ValueDecl (ss', _) (Just ident) _ _ _ [A.MkUnguarded e]) = (runIdent ident, exprToCoreFn ss' [] Nothing e)
memberCoreFn _ = error $ "Unexpected value in type class dictionary constructor application"
args = snd <$> sortBy (compare `on` fst) (memberCoreFn <$> ds)
ctor = Var (ss, [], Nothing, Just IsTypeClassConstructor) (fmap properToIdent name)
in foldl (App (ss, com, Nothing, Nothing)) ctor args
exprToCoreFn ss com ty (A.TypeClassDictionaryAccessor _ ident) =
Abs (ss, com, ty, Nothing) (Ident "dict")
(Accessor (ssAnn ss) (mkString $ runIdent ident) (Var (ssAnn ss) $ Qualified Nothing (Ident "dict")))
Expand Down
4 changes: 2 additions & 2 deletions src/Language/PureScript/Docs/Convert/Single.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ basicDeclaration :: P.SourceAnn -> Text -> DeclarationInfo -> Maybe Intermediate
basicDeclaration sa title = Just . Right . mkDeclaration sa title

convertDeclaration :: P.Declaration -> Text -> Maybe IntermediateDeclaration
convertDeclaration (P.ValueDecl sa _ _ _ [P.MkUnguarded (P.TypedValue _ _ ty)]) title =
convertDeclaration (P.ValueDecl sa _ _ _ _ [P.MkUnguarded (P.TypedValue _ _ ty)]) title =
basicDeclaration sa title (ValueDeclaration ty)
convertDeclaration (P.ValueDecl sa _ _ _ _) title =
convertDeclaration (P.ValueDecl sa _ _ _ _ _) title =
-- If no explicit type declaration was provided, insert a wildcard, so that
-- the actual type will be added during type checking.
basicDeclaration sa title (ValueDeclaration (P.TypeWildcard (fst sa)))
Expand Down
2 changes: 1 addition & 1 deletion src/Language/PureScript/Environment.hs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ data NameKind
-- ^ A private value introduced as an artifact of code generation (class instances, class member
-- accessors, etc.)
| Public
-- ^ A public value for a module member or foreing import declaration
-- ^ A public value for a module member or foreign import declaration
| External
-- ^ A name for member introduced by foreign import
deriving (Show, Eq, Generic)
Expand Down
2 changes: 1 addition & 1 deletion src/Language/PureScript/Ide/SourceFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extractSpans
-> [(IdeNamespaced, P.SourceSpan)]
-- ^ Declarations and their source locations
extractSpans d = case d of
P.ValueDecl (ss, _) i _ _ _ ->
P.ValueDecl (ss, _) _ i _ _ _ ->
[(IdeNamespaced IdeNSValue (P.runIdent i), ss)]
P.TypeSynonymDeclaration (ss, _) name _ _ ->
[(IdeNamespaced IdeNSType (P.runProperName name), ss)]
Expand Down
4 changes: 2 additions & 2 deletions src/Language/PureScript/Interactive/Module.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ createTemporaryModule exec st val =
supportImport = (supportModuleName, P.Implicit, Just (P.ModuleName [P.ProperName "$Support"]))
eval = P.Var internalSpan (P.Qualified (Just (P.ModuleName [P.ProperName "$Support"])) (P.Ident "eval"))
mainValue = P.App eval (P.Var internalSpan (P.Qualified Nothing (P.Ident "it")))
itDecl = P.ValueDecl (internalSpan, []) (P.Ident "it") P.Public [] [P.MkUnguarded val]
itDecl = P.ValueDecl (internalSpan, []) Nothing (P.Ident "it") P.Public [] [P.MkUnguarded val]
typeDecl = P.TypeDeclaration
(P.TypeDeclarationData (internalSpan, []) (P.Ident "$main")
(P.TypeApp
(P.TypeConstructor
(P.Qualified (Just (P.ModuleName [P.ProperName "$Effect"])) (P.ProperName "Effect")))
(P.TypeWildcard internalSpan)))
mainDecl = P.ValueDecl (internalSpan, []) (P.Ident "$main") P.Public [] [P.MkUnguarded mainValue]
mainDecl = P.ValueDecl (internalSpan, []) Nothing (P.Ident "$main") P.Public [] [P.MkUnguarded mainValue]
decls = if exec then [itDecl, typeDecl, mainDecl] else [itDecl]
in
P.Module internalSpan
Expand Down
6 changes: 3 additions & 3 deletions src/Language/PureScript/Linter/Exhaustive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ checkExhaustive ss env mn numArgs cas expr = makeResult . first ordNub $ foldl'
where
partial :: Text -> Text -> Declaration
partial var tyVar =
ValueDecl (ss, []) UnusedIdent Private [] $
ValueDecl (ss, []) Nothing UnusedIdent Private [] $
[MkUnguarded
(TypedValue
True
Expand Down Expand Up @@ -331,8 +331,8 @@ checkExhaustiveExpr initSS env mn = onExpr initSS
where
onDecl :: Declaration -> m Declaration
onDecl (BindingGroupDeclaration bs) = BindingGroupDeclaration <$> mapM (\(sai@((ss, _), _), nk, expr) -> (sai, nk,) <$> onExpr ss expr) bs
onDecl (ValueDecl sa@(ss, _) name x y [MkUnguarded e]) =
ValueDecl sa name x y . mkUnguardedExpr <$> censor (addHint (ErrorInValueDeclaration name)) (onExpr ss e)
onDecl (ValueDecl sa@(ss, _) publicName name x y [MkUnguarded e]) =
ValueDecl sa publicName name x y . mkUnguardedExpr <$> censor (addHint (ErrorInValueDeclaration name)) (onExpr ss e)
onDecl decl = return decl

onExpr :: SourceSpan -> Expr -> m Expr
Expand Down
2 changes: 1 addition & 1 deletion src/Language/PureScript/Parser/Declarations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ parseValueWithIdentAndBinders ident bs = do
<*> (indented *> equals
*> withSourceSpan PositionedValue parseValueWithWhereClause))
)
return $ \sa -> ValueDecl sa ident Public bs value
return $ \sa -> ValueDecl sa Nothing ident Public bs value

parseValueDeclaration :: TokenParser Declaration
parseValueDeclaration = withSourceAnnF $ do
Expand Down
7 changes: 4 additions & 3 deletions src/Language/PureScript/Pretty/Values.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Data.Text (Text)
import qualified Data.List.NonEmpty as NEL
import qualified Data.Monoid as Monoid ((<>))
import qualified Data.Text as T
import Data.Maybe (fromMaybe)

import Language.PureScript.AST
import Language.PureScript.Crash
Expand Down Expand Up @@ -131,12 +132,12 @@ prettyPrintDeclaration :: Int -> Declaration -> Box
prettyPrintDeclaration d _ | d < 0 = ellipsis
prettyPrintDeclaration _ (TypeDeclaration td) =
text (T.unpack (showIdent (tydeclIdent td)) ++ " :: ") <> typeAsBox (tydeclType td)
prettyPrintDeclaration d (ValueDecl _ ident _ [] [GuardedExpr [] val]) =
text (T.unpack (showIdent ident) ++ " = ") <> prettyPrintValue (d - 1) val
prettyPrintDeclaration d (ValueDecl _ publicName ident _ [] [GuardedExpr [] val]) =
text (T.unpack (showIdent (fromMaybe ident publicName)) ++ " = ") <> prettyPrintValue (d - 1) val
prettyPrintDeclaration d (BindingGroupDeclaration ds) =
vsep 1 left (NEL.toList (fmap (prettyPrintDeclaration (d - 1) . toDecl) ds))
where
toDecl ((sa, nm), t, e) = ValueDecl sa nm t [] [GuardedExpr [] e]
toDecl ((sa, nm), t, e) = ValueDecl sa Nothing nm t [] [GuardedExpr [] e]
prettyPrintDeclaration _ _ = internalError "Invalid argument to prettyPrintDeclaration"

prettyPrintCaseAlternative :: Int -> CaseAlternative -> Box
Expand Down
6 changes: 3 additions & 3 deletions src/Language/PureScript/Sugar/BindingGroups.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ collapseBindingGroups =
go (DataBindingGroupDeclaration ds) = NEL.toList ds
go (BindingGroupDeclaration ds) =
NEL.toList $ fmap (\((sa, ident), nameKind, val) ->
ValueDecl sa ident nameKind [] [MkUnguarded val]) ds
ValueDecl sa Nothing ident nameKind [] [MkUnguarded val]) ds
go other = [other]

collapseBindingGroupsForValue :: Expr -> Expr
Expand Down Expand Up @@ -187,7 +187,7 @@ toBindingGroup moduleName (CyclicSCC ds') = do
toBinding (CyclicSCC ds) = throwError $ foldMap cycleError ds

cycleError :: ValueDeclarationData Expr -> MultipleErrors
cycleError (ValueDeclarationData (ss, _) n _ _ _) = errorMessage' ss $ CycleInDeclaration n
cycleError (ValueDeclarationData (ss, _) _ n _ _ _) = errorMessage' ss $ CycleInDeclaration n

toDataBindingGroup
:: MonadError MultipleErrors m
Expand All @@ -209,5 +209,5 @@ mkDeclaration :: ValueDeclarationData Expr -> Declaration
mkDeclaration = ValueDeclaration . fmap (pure . MkUnguarded)

fromValueDecl :: ValueDeclarationData Expr -> ((SourceAnn, Ident), NameKind, Expr)
fromValueDecl (ValueDeclarationData sa ident nameKind [] val) = ((sa, ident), nameKind, val)
fromValueDecl (ValueDeclarationData sa _ ident nameKind [] val) = ((sa, ident), nameKind, val)
fromValueDecl ValueDeclarationData{} = internalError "Binders should have been desugared"
18 changes: 9 additions & 9 deletions src/Language/PureScript/Sugar/CaseDeclarations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ desugarGuardedExprs ss (Case scrut alternatives)
(scrut', scrut_decls) <- unzip <$> forM scrut (\e -> do
scrut_id <- freshIdent'
pure ( Var ss (Qualified Nothing scrut_id)
, ValueDecl (ss, []) scrut_id Private [] [MkUnguarded e]
, ValueDecl (ss, []) Nothing scrut_id Private [] [MkUnguarded e]
)
)
Let FromLet scrut_decls <$> desugarGuardedExprs ss (Case scrut' alternatives)
Expand Down Expand Up @@ -231,7 +231,7 @@ desugarGuardedExprs ss (Case scrut alternatives) =
alt_fail = [CaseAlternative [NullBinder] [MkUnguarded goto_rem_case]]

pure $ Let FromLet [
ValueDecl (ss, []) rem_case_id Private []
ValueDecl (ss, []) Nothing rem_case_id Private []
[MkUnguarded (Abs (VarBinder ss unused_binder) desugared)]
] (mk_body alt_fail)

Expand Down Expand Up @@ -328,10 +328,10 @@ desugarCases = desugarRest <=< fmap join . flip parU toDecls . groupBy inSameGro
desugarRest :: [Declaration] -> m [Declaration]
desugarRest (TypeInstanceDeclaration sa cd idx name constraints className tys ds : rest) =
(:) <$> (TypeInstanceDeclaration sa cd idx name constraints className tys <$> traverseTypeInstanceBody desugarCases ds) <*> desugarRest rest
desugarRest (ValueDecl sa name nameKind bs result : rest) =
desugarRest (ValueDecl sa publicName name nameKind bs result : rest) =
let (_, f, _) = everywhereOnValuesTopDownM return go return
f' = mapM (\(GuardedExpr gs e) -> GuardedExpr gs <$> f e)
in (:) <$> (ValueDecl sa name nameKind bs <$> f' result) <*> desugarRest rest
in (:) <$> (ValueDecl sa publicName name nameKind bs <$> f' result) <*> desugarRest rest
where
go (Let w ds val') = Let w <$> desugarCases ds <*> pure val'
go other = return other
Expand All @@ -343,19 +343,19 @@ inSameGroup (ValueDeclaration vd1) (ValueDeclaration vd2) = valdeclIdent vd1 ==
inSameGroup _ _ = False

toDecls :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]
toDecls [ValueDecl sa@(ss, _) ident nameKind bs [MkUnguarded val]] | all isIrrefutable bs = do
toDecls [ValueDecl sa@(ss, _) publicName ident nameKind bs [MkUnguarded val]] | all isIrrefutable bs = do
args <- mapM fromVarBinder bs
let body = foldr (Abs . VarBinder ss) val args
guardWith (errorMessage' ss (OverlappingArgNames (Just ident))) $ length (ordNub args) == length args
return [ValueDecl sa ident nameKind [] [MkUnguarded body]]
return [ValueDecl sa publicName ident nameKind [] [MkUnguarded body]]
where
fromVarBinder :: Binder -> m Ident
fromVarBinder NullBinder = freshIdent'
fromVarBinder (VarBinder _ name) = return name
fromVarBinder (PositionedBinder _ _ b) = fromVarBinder b
fromVarBinder (TypedBinder _ b) = fromVarBinder b
fromVarBinder _ = internalError "fromVarBinder: Invalid argument"
toDecls ds@(ValueDecl (ss, _) ident _ bs (result : _) : _) = do
toDecls ds@(ValueDecl (ss, _) _ ident _ bs (result : _) : _) = do
let tuples = map toTuple ds

isGuarded (MkUnguarded _) = False
Expand All @@ -370,7 +370,7 @@ toDecls ds@(ValueDecl (ss, _) ident _ bs (result : _) : _) = do
toDecls ds = return ds

toTuple :: Declaration -> ([Binder], [GuardedExpr])
toTuple (ValueDecl _ _ _ bs result) = (bs, result)
toTuple (ValueDecl _ _ _ _ bs result) = (bs, result)
toTuple _ = internalError "Not a value declaration"

makeCaseDeclaration :: forall m. (MonadSupply m) => SourceSpan -> Ident -> [([Binder], [GuardedExpr])] -> m Declaration
Expand All @@ -384,7 +384,7 @@ makeCaseDeclaration ss ident alternatives = do
binders = [ CaseAlternative bs result | (bs, result) <- alternatives ]
let value = foldr (Abs . VarBinder ss) (Case vars binders) args

return $ ValueDecl (ss, []) ident Public [] [MkUnguarded value]
return $ ValueDecl (ss, []) Nothing ident Public [] [MkUnguarded value]
where
-- We will construct a table of potential names.
-- VarBinders will become Just _ which is a potential name.
Expand Down
2 changes: 1 addition & 1 deletion src/Language/PureScript/Sugar/DoNotation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ desugarDo d =
go _ [DoNotationLet _] = throwError . errorMessage $ InvalidDoLet
go pos (DoNotationLet ds : rest) = do
let checkBind :: Declaration -> m ()
checkBind (ValueDecl (ss, _) i@(Ident name) _ _ _)
checkBind (ValueDecl (ss, _) _ i@(Ident name) _ _ _)
| name `elem` [ C.bind, C.discard ] = throwError . errorMessage' ss $ CannotUseBindWithDo i
checkBind _ = pure ()
mapM_ checkBind ds
Expand Down
2 changes: 1 addition & 1 deletion src/Language/PureScript/Sugar/ObjectWildcards.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ desugarDecl d = rethrowWithPosition (declSourceSpan d) $ fn d
then Abs (VarBinder nullSourceSpan val) <$> wrapLambda (buildUpdates valExpr) ps
else wrapLambda (buildLet val . buildUpdates valExpr) ps
where
buildLet val = Let FromLet [ValueDecl (declSourceSpan d, []) val Public [] [MkUnguarded obj]]
buildLet val = Let FromLet [ValueDecl (declSourceSpan d, []) Nothing val Public [] [MkUnguarded obj]]

-- recursively build up the nested `ObjectUpdate` expressions
buildUpdates :: Expr -> PathTree Expr -> Expr
Expand Down
Loading