@@ -101,7 +101,7 @@ toDecls [ValueDeclaration ident nameKind bs (Right val)] | all isVarBinder bs =
101 isVarBinder (VarBinder _) = True
101 isVarBinder (VarBinder _) = True
102 isVarBinder (PositionedBinder _ _ b) = isVarBinder b
102 isVarBinder (PositionedBinder _ _ b) = isVarBinder b
103 isVarBinder _ = False
103 isVarBinder _ = False
105 fromVarBinder :: Binder -> m Ident
105 fromVarBinder :: Binder -> m Ident
106 fromVarBinder NullBinder = Ident <$> freshName
106 fromVarBinder NullBinder = Ident <$> freshName
107 fromVarBinder (VarBinder name) = return name
107 fromVarBinder (VarBinder name) = return name
@@ -129,17 +129,17 @@ makeCaseDeclaration :: forall m. (Functor m, Applicative m, MonadSupply m, Monad
129makeCaseDeclaration ident alternatives = do
129makeCaseDeclaration ident alternatives = do
130 let namedArgs = map findName . fst <$> alternatives
130 let namedArgs = map findName . fst <$> alternatives
131 argNames = map join $ foldl1 resolveNames namedArgs
131 argNames = map join $ foldl1 resolveNames namedArgs
132− args <- if allUnique (catMaybes argNames)
132+ args <- if allUnique (catMaybes argNames)
133− then mapM argName argNames
133+ then mapM argName argNames
134 else replicateM (length argNames) (Ident <$> freshName)
134 else replicateM (length argNames) (Ident <$> freshName)
135 let vars = map (Var . Qualified Nothing) args
135 let vars = map (Var . Qualified Nothing) args
136 binders = [ CaseAlternative bs result | (bs, result) <- alternatives ]
136 binders = [ CaseAlternative bs result | (bs, result) <- alternatives ]
137 value = foldr (Abs . Left) (Case vars binders) args
137 value = foldr (Abs . Left) (Case vars binders) args
138− return $ ValueDeclaration ident Value [] (Right value)
138+ return $ ValueDeclaration ident Public [] (Right value)
140 -- We will construct a table of potential names.
140 -- We will construct a table of potential names.
141 -- VarBinders will become Just (Just _) which is a potential name.
141 -- VarBinders will become Just (Just _) which is a potential name.
142− -- NullBinder will become Just Nothing, which indicates that we may
142+ -- NullBinder will become Just Nothing, which indicates that we may
143 -- have to generate a name.
143 -- have to generate a name.
144 -- Everything else becomes Nothing, which indicates that we definitely
144 -- Everything else becomes Nothing, which indicates that we definitely
145 -- have to generate a name.
145 -- have to generate a name.
@@ -162,15 +162,15 @@ makeCaseDeclaration ident alternatives = do
163 -- Combine two lists of potential names from two case alternatives
163 -- Combine two lists of potential names from two case alternatives
164 -- by zipping correspoding columns.
164 -- by zipping correspoding columns.
165− resolveNames :: [Maybe (Maybe Ident)] ->
165+ resolveNames :: [Maybe (Maybe Ident)] ->
166− [Maybe (Maybe Ident)] ->
166+ [Maybe (Maybe Ident)] ->
167 [Maybe (Maybe Ident)]
167 [Maybe (Maybe Ident)]
168 resolveNames = zipWith resolveName
168 resolveNames = zipWith resolveName
170 -- Resolve a pair of names. VarBinder beats NullBinder, and everything
170 -- Resolve a pair of names. VarBinder beats NullBinder, and everything
171 -- else results in Nothing.
171 -- else results in Nothing.
172− resolveName :: Maybe (Maybe Ident) ->
172+ resolveName :: Maybe (Maybe Ident) ->
173− Maybe (Maybe Ident) ->
173+ Maybe (Maybe Ident) ->
174 Maybe (Maybe Ident)
174 Maybe (Maybe Ident)
175 resolveName (Just (Just a)) (Just (Just b))
175 resolveName (Just (Just a)) (Just (Just b))
176 | a == b = Just (Just a)
176 | a == b = Just (Just a)