git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Auto-import prelude
af10a2aGary Burgess
examples/passing/AutoPrelude.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Debug.Trace
4+
5+f x = x * 10
6+g y = y - 10
7+
8+main = trace $ show $ (f <<< g) 100
examples/passing/AutoPrelude2.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import qualified Prelude as P
4+import Debug.Trace
5+
6+f :: forall a. a -> a
7+f = P.id
8+
9+main = P.($) trace ((P.(<<<) f f) "Done")
src/Language/PureScript/Sugar/Names.hs+1−1
@@ -323,7 +323,7 @@ type ExplicitImports = [DeclarationRef]
323-- explicitly imported declarations.
323-- explicitly imported declarations.
324--
324--
325findImports :: [Declaration] -> M.Map ModuleName (Maybe ExplicitImports, Maybe ModuleName)
325findImports :: [Declaration] -> M.Map ModuleName (Maybe ExplicitImports, Maybe ModuleName)
326−findImports = foldl findImports' M.empty
326+findImports = M.insertWith (flip const) (ModuleName [ProperName "Prelude"]) (Nothing, Nothing) . foldl findImports' M.empty
327 where
327 where
328 findImports' result (ImportDeclaration mn expl qual) = M.insert mn (expl, qual) result
328 findImports' result (ImportDeclaration mn expl qual) = M.insert mn (expl, qual) result
329 findImports' result _ = result
329 findImports' result _ = result