git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #943 from purescript/942
98a59c2Phil Freeman
examples/manual/QualifiedNames.pursnew file+11
@@ -0,0 +1,11 @@
1+module Data.Either where
2+
3+data Either a b = Left a | Right b
4+
5+module Main where
6+
7+either :: forall a b c. (a -> c) -> (b -> c) -> Data.Either.Either a b -> c
8+either f _ (Data.Either.Left x) = f x
9+either _ g (Data.Either.Right y) = g y
10+
11+main = Debug.Trace.trace (either id id (Data.Either.Left "Done"))
src/Language/PureScript/CoreFn/Desugar.hs+6−1
@@ -190,12 +190,17 @@ moduleToCoreFn env (A.Module coms mn decls (Just exps)) =
190--
190--
191findQualModules :: [A.Declaration] -> [ModuleName]
191findQualModules :: [A.Declaration] -> [ModuleName]
192findQualModules decls =
192findQualModules decls =
193− let (f, _, _, _, _) = everythingOnValues (++) (const []) fqValues (const []) (const []) (const [])
193+ let (f, _, _, _, _) = everythingOnValues (++) (const []) fqValues fqBinders (const []) (const [])
194 in f `concatMap` decls
194 in f `concatMap` decls
195 where
195 where
196 fqValues :: A.Expr -> [ModuleName]
196 fqValues :: A.Expr -> [ModuleName]
197 fqValues (A.Var (Qualified (Just mn) _)) = [mn]
197 fqValues (A.Var (Qualified (Just mn) _)) = [mn]
198+ fqValues (A.Constructor (Qualified (Just mn) _)) = [mn]
198 fqValues _ = []
199 fqValues _ = []
200+
201+ fqBinders :: A.Binder -> [ModuleName]
202+ fqBinders (A.ConstructorBinder (Qualified (Just mn) _) _) = [mn]
203+ fqBinders _ = []
199
204
200-- |
205-- |
201-- Desugars import declarations from AST to CoreFn representation.
206-- Desugars import declarations from AST to CoreFn representation.