git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Auto-import prelude
commitaf10a2ac226b780413ad1796c7919f28d61651b6 authorGary Burgess <gary.burgess@gmail.com> dateMon 17 Mar 2014, 23:19 (13 years ago) parent583cc6b
3 files changed+18−1
examples/passing/AutoPrelude.purs+8 examples/passing/AutoPrelude2.purs+9 src/Language/PureScript/Sugar/Names.hs+1−1
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]
323323-- explicitly imported declarations.
324324--
325325findImports :: [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
327327 where
328328 findImports' result (ImportDeclaration mn expl qual) = M.insert mn (expl, qual) result
329329 findImports' result _ = result