git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Require imports for qualified names to resolve
commit66c1f7449c2ff08986c4e50e6aba269b36c940e0 authorGary Burgess <gary.burgess@gmail.com> dateMon 16 May 2016, 02:05 (10 years ago) parentca98825
127 files changed+349−255
core-tests/tests/generic-deriving/Main.purs+5−5 examples/failing/ExportExplicit1.purs+2−1 examples/failing/ExportExplicit3.purs+4−3 examples/failing/RowConstructors1.purs+2−2 examples/failing/RowConstructors2.purs+2−2 examples/failing/RowConstructors3.purs+2−2 examples/failing/TypedBinders.purs+3−3 examples/failing/TypedBinders2.purs+3−3 examples/failing/TypedBinders3.purs+2−1 examples/failing/UnderscoreModuleName.purs+2−2 examples/passing/1185.purs+3−1 examples/passing/1570.purs+3−1 examples/passing/1697.purs+2−1 examples/passing/1881.purs+5−3 examples/passing/1991.purs+3−2 examples/passing/652.purs+2−1 examples/passing/810.purs+2−1 examples/passing/Applicative.purs+2−2 examples/passing/ArrayType.purs+2−1 examples/passing/Auto.purs+2−1 examples/passing/BindersInFunctions.purs+2−1 examples/passing/BindingGroups.purs+2−1 examples/passing/BlockString.purs+2−1 examples/passing/CaseStatement.purs+2−1 examples/passing/CheckFunction.purs+2−1 examples/passing/CheckSynonymBug.purs+2−1 examples/passing/CheckTypeClass.purs+2−2 examples/passing/Church.purs+2−2 examples/passing/ClassRefSyntax.purs+5−4 examples/passing/Conditional.purs+2−2 examples/passing/DataAndType.purs+2−1 examples/passing/DeepArrayBinder.purs+2−1 examples/passing/Do.purs+3−2 examples/passing/Dollar.purs+2−2 examples/passing/EmptyDataDecls.purs+2−1 examples/passing/EmptyRow.purs+2−1 examples/passing/ExplicitOperatorSections.purs+2−1 examples/passing/ExportExplicit.purs+2−1 examples/passing/ExportExplicit2.purs+2−1 examples/passing/FunctionScope.purs+2−1 examples/passing/Functions2.purs+2−1 examples/passing/Guards.purs+2−1 examples/passing/IfThenElseMaybe.purs+2−1 examples/passing/ImplicitEmptyImport.purs+4−3 examples/passing/Import.purs+2−1 examples/passing/ImportExplicit.purs+2−1 examples/passing/InstanceBeforeClass.purs+2−1 examples/passing/IntAndChar.purs+2−1 examples/passing/JSReserved.purs+2−1 examples/passing/KindedType.purs+2−1 examples/passing/LargeSumType.purs+4−2 examples/passing/LetInInstance.purs+2−1 examples/passing/LiberalTypeSynonyms.purs+2−1 examples/passing/MPTCs.purs+3−2 examples/passing/Match.purs+2−1 examples/passing/Module.purs+2−1 examples/passing/Module/M1.purs+1−1 examples/passing/Module/M2.purs+1 examples/passing/ModuleDeps.purs+2−1 examples/passing/ModuleDeps/M1.purs+1−1 examples/passing/ModuleDeps/M2.purs+1−1 examples/passing/Monad.purs+2−2 examples/passing/MutRec.purs+2−1 examples/passing/MutRec2.purs+2−1 examples/passing/MutRec3.purs+2−1 examples/passing/NamedPatterns.purs+2−1 examples/passing/NegativeBinder.purs+2−1 examples/passing/NegativeIntInRange.purs+2−1 examples/passing/Nested.purs+2−1 examples/passing/NestedWhere.purs+2−1 examples/passing/NonConflictingExports.purs+5−4 examples/passing/ObjectSynonym.purs+2−1 examples/passing/ObjectUpdate2.purs+2−1 examples/passing/Objects.purs+2−1 examples/passing/OneConstructor.purs+2−1 examples/passing/Operators.purs+4−8 examples/passing/Operators/Other.purs+7 examples/passing/OptimizerBug.purs+2−1 examples/passing/Patterns.purs+2−1 examples/passing/PendingConflictingImports.purs+2−1 examples/passing/PendingConflictingImports2.purs+6−5 examples/passing/QualifiedNames.purs+3−1 examples/passing/Rank2Types.purs+2−1 examples/passing/ReExportQualified.purs+2−1 examples/passing/Recursion.purs+2−1 examples/passing/RedefinedFixity.purs+2−1 examples/passing/ReservedWords.purs+2−1 examples/passing/ResolvableScopeConflict.purs+2−1 examples/passing/ResolvableScopeConflict2.purs+2−1 examples/passing/ResolvableScopeConflict3.purs+2−1 examples/passing/RowConstructors.purs+2−1 examples/passing/RowPolyInstanceContext.purs+2−1 examples/passing/ScopedTypeVariables.purs+2−1 examples/passing/Sequence.purs+2−1 examples/passing/SequenceDesugared.purs+5−4 examples/passing/ShadowedName.purs+2−1 examples/passing/SignedNumericLiterals.purs+2−1 examples/passing/TCOCase.purs+2−1 examples/passing/Tick.purs+2−1 examples/passing/TopLevelCase.purs+2−1 examples/passing/TransitiveImport/Middle.purs+3−1 examples/passing/TypeClasses.purs+3−3 examples/passing/TypeClassesInOrder.purs+2−1 examples/passing/TypeClassesWithOverlappingTypeVariables.purs+3−2 examples/passing/TypeDecl.purs+2−1 examples/passing/TypeOperators.purs+2−1 examples/passing/TypeSynonymInData.purs+2−1 examples/passing/TypeSynonyms.purs+2−1 examples/passing/TypeWildcards.purs+2−1 examples/passing/TypeWildcardsRecordExtension.purs+2−1 examples/passing/TypeWithoutParens.purs+2−1 examples/passing/TypedBinders.purs+3−2 examples/passing/TypedWhere.purs+2−1 examples/passing/UnderscoreIdent.purs+2−1 examples/passing/UnicodeIdentifier.purs+3−1 examples/passing/UnicodeOperators.purs+3−1 examples/passing/UnknownInTypeClassLookup.purs+2−1 examples/passing/UntupledConstraints.purs+1−1 examples/passing/WildcardType.purs+2−3 examples/passing/iota.purs+3−1 examples/passing/s.purs+2−1 purescript.cabal+1 src/Language/PureScript/Linter/Imports.hs+5−2 src/Language/PureScript/Sugar/Names.hs+29−67 src/Language/PureScript/Sugar/Names/Env.hs+24−8 src/Language/PureScript/Sugar/Names/Imports.hs+5−4 tests/support/bower.json+1−1
core-tests/tests/generic-deriving/Main.purs+5−5
@@ -2,18 +2,18 @@ module GenericDeriving where
22
33import Prelude
44
5−import Control.Monad.Eff (Eff())
6−import Control.Monad.Eff.Console (CONSOLE())
5+import Control.Monad.Eff (Eff)
6+import Control.Monad.Eff.Console (CONSOLE, log)
77import Data.Generic
88
99data Void
1010
1111derive instance genericVoid :: Generic Void
1212
13−data A a
13+data A a
1414 = A Number String
1515 | B Int
16− | C (Array (A a))
16+ | C (Array (A a))
1717 | D { "asgård" :: a }
1818 | E Void
1919
@@ -24,4 +24,4 @@ newtype X b = X b
2424derive instance genericX :: Generic (X String)
2525
2626main :: forall eff. Eff (console :: CONSOLE | eff) Unit
27−main = Control.Monad.Eff.Console.log (gShow (D { "asgård": C [ A 1.0 "test", B 42, D { "asgård": true } ] }))
27+main = log (gShow (D { "asgård": C [ A 1.0 "test", B 42, D { "asgård": true } ] }))
examples/failing/ExportExplicit1.purs+2−1
@@ -2,10 +2,11 @@
22module Main where
33
44import M1
5+import Control.Monad.Eff.Console (log)
56
67testX = X
78
89-- should fail as Y constructor is not exported from M1
910testY = Y
1011
11−main = Control.Monad.Eff.Console.log "Done"
12+main = log "Done"
examples/failing/ExportExplicit3.purs+4−3
@@ -1,9 +1,10 @@
11-- @shouldFailWith UnknownName
22module Main where
33
4−import M1
4+import M1 as M
5+import Control.Monad.Eff.Console (log)
56
67-- should fail as Z is not exported from M1
7−testZ = M1.Z
8+testZ = M.Z
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/failing/RowConstructors1.purs+2−2
@@ -1,9 +1,9 @@
11-- @shouldFailWith KindsDoNotUnify
22module Main where
33
4−import Prelude
4+import Control.Monad.Eff.Console (log)
55
66data Foo = Bar
77type Baz = { | Foo }
88
9−main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/failing/RowConstructors2.purs+2−2
@@ -1,9 +1,9 @@
11-- @shouldFailWith KindsDoNotUnify
22module Main where
33
4−import Prelude
4+import Control.Monad.Eff.Console (log)
55
66type Foo r = (x :: Number | r)
77type Bar = { | Foo }
88
9−main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/failing/RowConstructors3.purs+2−2
@@ -1,9 +1,9 @@
11-- @shouldFailWith KindsDoNotUnify
22module Main where
33
4−import Prelude
4+import Control.Monad.Eff.Console (log)
55
66type Foo = { x :: Number }
77type Bar = { | Foo }
88
9−main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/failing/TypedBinders.purs+3−3
@@ -1,10 +1,10 @@
1−-- @shouldFailWith ErrorParsingModule
1+-- @shouldFailWith ErrorParsingModule
22module Main where
33
4−import Prelude
4+import Control.Monad.Eff.Console (log)
55
66test = (\f :: Int -> Int -> f 10) id
77
88main = do
99 let t1 = test
10− Control.Monad.Eff.Console.log "Done"
10+ log "Done"
examples/failing/TypedBinders2.purs+3−3
@@ -2,8 +2,8 @@
22module Main where
33
44import Prelude
5+import Control.Monad.Eff.Console (log)
56
67main = do
7− s :: String <- Control.Monad.Eff.Console.log "Foo"
8− Control.Monad.Eff.Console.log "Done"
9−
8+ s :: String <- log "Foo"
9+ log "Done"
examples/failing/TypedBinders3.purs+2−1
@@ -2,6 +2,7 @@
22module Main where
33
44import Prelude
5+import Control.Monad.Eff.Console (log)
56
67test = case 1 of
78 (0 :: String) -> true
@@ -9,4 +10,4 @@ test = case 1 of
910
1011main = do
1112 let t = test
12− Control.Monad.Eff.Console.log "Done"
13+ log "Done"
examples/failing/UnderscoreModuleName.purs+2−2
@@ -1,6 +1,6 @@
11-- @shouldFailWith ErrorParsingModule
22module Bad_Module where
33
4−import Prelude
4+import Control.Monad.Eff.Console (log)
55
6−main = Control.Monad.Eff.Console.log "Done"
6+main = log "Done"
examples/passing/1185.purs+3−1
@@ -1,5 +1,7 @@
11module Main where
22
3+import Control.Monad.Eff.Console (log)
4+
35data Person = Person String Boolean
46
57getName :: Person -> String
@@ -10,4 +12,4 @@ getName p = case p of
1012name :: String
1113name = getName (Person "John Smith" true)
1214
13−main = Control.Monad.Eff.Console.log "Done"
15+main = log "Done"
examples/passing/1570.purs+3−1
@@ -1,6 +1,8 @@
11module Main where
22
3+import Control.Monad.Eff.Console (log)
4+
35test :: forall a. a -> a
46test = \(x :: a) -> x
57
6−main = Control.Monad.Eff.Console.log "Done"
8+main = log "Done"
examples/passing/1697.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56_2 :: forall a. a -> a
67_2 a = a
@@ -21,4 +22,4 @@ wtf = do
2122 let tmp = _2 1
2223 pure unit
2324
24−main = Control.Monad.Eff.Console.log "Done"
25+main = log "Done"
examples/passing/1881.purs+5−3
@@ -1,9 +1,11 @@
11module Main where
22
3−foo =
3+import Control.Monad.Eff.Console (log)
4+
5+foo =
46 1
57
6−bar
8+bar
79 = 2
810
911baz
@@ -14,4 +16,4 @@ qux
1416 =
1517 3
1618
17−main = Control.Monad.Eff.Console.log "Done"
19+main = log "Done"
examples/passing/1991.purs+3−2
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56singleton :: forall a. a -> Array a
67singleton x = [x]
@@ -17,5 +18,5 @@ regression =
1718 let as = [1,2,3,4,5]
1819 as' = foldMap (\x -> if 1 < x && x < 4 then singleton x else empty) as
1920 in as'
20−
21−main = Control.Monad.Eff.Console.log "Done"
21+
22+main = log "Done"
examples/passing/652.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56class Foo a b
67
@@ -14,4 +15,4 @@ instance bar :: Bar (a -> b) b
1415
1516instance baz :: (Eq a) => Baz (a -> b) a b
1617
17−main = Control.Monad.Eff.Console.log "Done"
18+main = log "Done"
examples/passing/810.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Maybe a = Nothing | Just a
67
@@ -10,4 +11,4 @@ test m = o.x
1011 o = case m of Nothing -> { x : Nothing }
1112 Just a -> { x : Just a }
1213
13−main = Control.Monad.Eff.Console.log "Done"
14+main = log "Done"
examples/passing/Applicative.purs+2−2
@@ -1,6 +1,6 @@
11module Main where
22
3−import Prelude ()
3+import Control.Monad.Eff.Console (log)
44
55class Applicative f where
66 pure :: forall a. a -> f a
@@ -13,4 +13,4 @@ instance applicativeMaybe :: Applicative Maybe where
1313 apply (Just f) (Just a) = Just (f a)
1414 apply _ _ = Nothing
1515
16−main = Control.Monad.Eff.Console.log "Done"
16+main = log "Done"
examples/passing/ArrayType.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56class Pointed p where
67 point :: forall a. a -> p a
@@ -8,4 +9,4 @@ class Pointed p where
89instance pointedArray :: Pointed Array where
910 point a = [a]
1011
11−main = Control.Monad.Eff.Console.log "Done"
12+main = log "Done"
examples/passing/Auto.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Auto s i o = Auto { state :: s, step :: s -> i -> o }
67
@@ -12,4 +13,4 @@ exists = \state step f -> f (Auto { state: state, step: step })
1213run :: forall i o. SomeAuto i o -> i -> o
1314run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
1415
15−main = Control.Monad.Eff.Console.log "Done"
16+main = log "Done"
examples/passing/BindersInFunctions.purs+2−1
@@ -4,6 +4,7 @@ import Prelude
44import Partial.Unsafe (unsafePartial)
55import Test.Assert (assert')
66import Control.Monad.Eff (Eff)
7+import Control.Monad.Eff.Console (log)
78
89snd :: forall a. Partial => Array a -> a
910snd = \[_, y] -> y
@@ -12,4 +13,4 @@ main :: Eff _ _
1213main = do
1314 let ts = unsafePartial (snd [1.0, 2.0])
1415 assert' "Incorrect result from 'snd'." (ts == 2.0)
15− Control.Monad.Eff.Console.log "Done"
16+ log "Done"
examples/passing/BindingGroups.purs+2−1
@@ -1,10 +1,11 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56foo = bar
67 where bar r = r + 1.0
78
89r = foo 2.0
910
10−main = Control.Monad.Eff.Console.log "Done"
11+main = log "Done"
examples/passing/BlockString.purs+2−1
@@ -1,8 +1,9 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56foo :: String
67foo = """foo"""
78
8−main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/passing/CaseStatement.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data A = A | B | C
67
@@ -18,4 +19,4 @@ h f N a = a
1819h f a N = a
1920h f (J a) (J b) = J (f a b)
2021
21−main = Control.Monad.Eff.Console.log $ f "Done" "Failed" A
22+main = log $ f "Done" "Failed" A
examples/passing/CheckFunction.purs+2−1
@@ -1,7 +1,8 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0
67
7−main = Control.Monad.Eff.Console.log "Done"
8+main = log "Done"
examples/passing/CheckSynonymBug.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56length :: forall a. Array a -> Int
67length _ = 0
@@ -9,4 +10,4 @@ type Foo a = Array a
910
1011foo _ = length ([] :: Foo Number)
1112
12−main = Control.Monad.Eff.Console.log "Done"
13+main = log "Done"
examples/passing/CheckTypeClass.purs+2−2
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Bar a = Bar
67data Baz
@@ -14,5 +15,4 @@ foo_ x = foo ((mkBar :: forall a. (Foo a) => a -> Bar a) x)
1415mkBar :: forall a. a -> Bar a
1516mkBar _ = Bar
1617
17−main = Control.Monad.Eff.Console.log "Done"
18−
18+main = log "Done"
examples/passing/Church.purs+2−2
@@ -1,6 +1,6 @@
11module Main where
22
3−import Prelude ()
3+import Control.Monad.Eff.Console (log)
44
55type List a = forall r. r -> (a -> r -> r) -> r
66
@@ -15,4 +15,4 @@ append = \l1 l2 r f -> l2 (l1 r f) f
1515
1616test = append (cons 1 empty) (cons 2 empty)
1717
18−main = Control.Monad.Eff.Console.log "Done"
18+main = log "Done"
examples/passing/ClassRefSyntax.purs+5−4
@@ -1,8 +1,9 @@
11module Main where
22
3− import Lib (class X, go)
3+import Lib (class X, go)
4+import Control.Monad.Eff.Console (log)
45
5− go' :: forall a. (X a) => a -> a
6− go' = go
6+go' :: forall a. (X a) => a -> a
7+go' = go
78
8− main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/passing/Conditional.purs+2−2
@@ -1,9 +1,9 @@
11module Main where
22
3−import Prelude ()
3+import Control.Monad.Eff.Console (log)
44
55fns = \f -> if f true then f else \x -> x
66
77not = \x -> if x then false else true
88
9−main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/passing/DataAndType.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data A = A B
67
78type B = A
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/DeepArrayBinder.purs+2−1
@@ -2,6 +2,7 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5+import Control.Monad.Eff.Console (log)
56import Test.Assert
67
78data List a = Cons a (List a) | Nil
@@ -13,4 +14,4 @@ match2 _ = 0.0
1314main = do
1415 let result = match2 (Cons 1.0 (Cons 2.0 (Cons 3.0 (Cons 4.0 (Cons 5.0 (Cons 6.0 (Cons 7.0 (Cons 8.0 (Cons 9.0 Nil)))))))))
1516 assert' "Incorrect result!" (result == 100.0)
16− Control.Monad.Eff.Console.log "Done"
17+ log "Done"
examples/passing/Do.purs+3−2
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Maybe a = Nothing | Just a
67
@@ -19,7 +20,7 @@ instance bindMaybe :: Bind Maybe where
1920 bind Nothing _ = Nothing
2021 bind (Just a) f = f a
2122
22−instance monadMaybe :: Prelude.Monad Maybe
23+instance monadMaybe :: Monad Maybe
2324
2425test1 = \_ -> do
2526 Just "abc"
@@ -64,4 +65,4 @@ test10 _ = do
6465 g x = f x / 2.0
6566 Just (f 10.0)
6667
67−main = Control.Monad.Eff.Console.log "Done"
68+main = log "Done"
examples/passing/Dollar.purs+2−2
@@ -1,6 +1,6 @@
11module Main where
22
3−import Prelude ()
3+import Control.Monad.Eff.Console (log)
44
55applyFn :: forall a b. (a -> b) -> a -> b
66applyFn f x = f x
@@ -13,4 +13,4 @@ test1 x = id $ id $ id $ id $ x
1313
1414test2 x = id id $ id x
1515
16−main = Control.Monad.Eff.Console.log "Done"
16+main = log "Done"
examples/passing/EmptyDataDecls.purs+2−1
@@ -2,6 +2,7 @@ module Main where
22
33import Prelude
44import Test.Assert
5+import Control.Monad.Eff.Console (log)
56
67data Z
78data S n
@@ -15,5 +16,5 @@ cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a
1516cons' x (ArrayBox xs) = ArrayBox $ append [x] xs
1617
1718main = case cons' 1 $ cons' 2 $ cons' 3 nil of
18− ArrayBox [1, 2, 3] -> Control.Monad.Eff.Console.log "Done"
19+ ArrayBox [1, 2, 3] -> log "Done"
1920 _ -> assert' "Failed" false
examples/passing/EmptyRow.purs+2−1
@@ -1,10 +1,11 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Foo r = Foo { | r }
67
78test :: Foo ()
89test = Foo {}
910
10−main = Control.Monad.Eff.Console.log "Done"
11+main = log "Done"
examples/passing/ExplicitOperatorSections.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56subtractOne :: Int -> Int
67subtractOne = (_ - 1)
@@ -11,4 +12,4 @@ addOne = (1 + _)
1112named :: Int -> Int
1213named = (_ `sub` 1)
1314
14−main = Control.Monad.Eff.Console.log "Done"
15+main = log "Done"
examples/passing/ExportExplicit.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import M1
4+import Control.Monad.Eff.Console (log)
45
56testX = X
67testZ = Z
78testFoo = foo
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/ExportExplicit2.purs+2−1
@@ -1,7 +1,8 @@
11module Main where
22
33import M1
4+import Control.Monad.Eff.Console (log)
45
56testBar = bar
67
7−main = Control.Monad.Eff.Console.log "Done"
8+main = log "Done"
examples/passing/FunctionScope.purs+2−1
@@ -2,6 +2,7 @@ module Main where
22
33import Prelude
44import Test.Assert
5+import Control.Monad.Eff.Console (log)
56
67mkValue :: Number -> Number
78mkValue id = id
@@ -9,4 +10,4 @@ mkValue id = id
910main = do
1011 let value = mkValue 1.0
1112 assert $ value == 1.0
12− Control.Monad.Eff.Console.log "Done"
13+ log "Done"
examples/passing/Functions2.purs+2−1
@@ -2,6 +2,7 @@ module Main where
22
33import Prelude
44import Test.Assert
5+import Control.Monad.Eff.Console (log)
56
67test :: forall a b. a -> b -> a
78test = \const _ -> const
@@ -9,4 +10,4 @@ test = \const _ -> const
910main = do
1011 let value = test "Done" {}
1112 assert' "Not done" $ value == "Done"
12− Control.Monad.Eff.Console.log "Done"
13+ log "Done"
examples/passing/Guards.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56collatz = \x -> case x of
67 y | y `mod` 2.0 == 0.0 -> y / 2.0
@@ -26,4 +27,4 @@ testIndentation x y | x > 0.0
2627 | otherwise
2728 = y - x
2829
29−main = Control.Monad.Eff.Console.log $ min "Done" "ZZZZ"
30+main = log $ min "Done" "ZZZZ"
examples/passing/IfThenElseMaybe.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Maybe a = Nothing | Just a
67
@@ -8,4 +9,4 @@ test1 = if true then Just 10 else Nothing
89
910test2 = if true then Nothing else Just 10
1011
11−main = Control.Monad.Eff.Console.log "Done"
12+main = log "Done"
examples/passing/ImplicitEmptyImport.purs+4−3
@@ -1,8 +1,9 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56main = do
6− Control.Monad.Eff.Console.log "Hello"
7− Control.Monad.Eff.Console.log "Goodbye"
8− Control.Monad.Eff.Console.log "Done"
7+ log "Hello"
8+ log "Goodbye"
9+ log "Done"
examples/passing/Import.purs+2−1
@@ -1,5 +1,6 @@
11module Main where
22
33import M2
4+import Control.Monad.Eff.Console (log)
45
5−main = Control.Monad.Eff.Console.log "Done"
6+main = log "Done"
examples/passing/ImportExplicit.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import M1 (X(..))
4+import Control.Monad.Eff.Console (log)
45
56testX :: X
67testX = X
78testY = Y
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/InstanceBeforeClass.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56instance fooNumber :: Foo Number where
67 foo = 0.0
@@ -8,4 +9,4 @@ instance fooNumber :: Foo Number where
89class Foo a where
910 foo :: a
1011
11−main = Control.Monad.Eff.Console.log "Done"
12+main = log "Done"
examples/passing/IntAndChar.purs+2−1
@@ -2,6 +2,7 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5+import Control.Monad.Eff.Console (log)
56import Test.Assert
67
78f 1 = 1
@@ -15,4 +16,4 @@ main = do
1516 assert $ f 0 == 0
1617 assert $ g 'a' == 'a'
1718 assert $ g 'b' == 'b'
18− Control.Monad.Eff.Console.log "Done"
19+ log "Done"
examples/passing/JSReserved.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56yield = 0
67member = 1
@@ -9,4 +10,4 @@ public = \return -> return
910
1011this catch = catch
1112
12−main = Control.Monad.Eff.Console.log "Done"
13+main = log "Done"
examples/passing/KindedType.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56type Star2Star f = f :: * -> *
67
@@ -30,4 +31,4 @@ class Clazz (a :: *) where
3031instance clazzString :: Clazz String where
3132 def = "test"
3233
33−main = Control.Monad.Eff.Console.log "Done"
34+main = log "Done"
examples/passing/LargeSumType.purs+4−2
@@ -1,5 +1,7 @@
11module Main where
2−
2+
3+import Control.Monad.Eff.Console (log)
4+
35data Large = A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
46
57explode A A = "A"
@@ -30,4 +32,4 @@ explode Y Y = "Y"
3032explode Z Z = "Z"
3133explode _ _ = ""
3234
33−main = Control.Monad.Eff.Console.log "Done"
35+main = log "Done"
examples/passing/LetInInstance.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56class Foo a where
67 foo :: a -> String
@@ -11,4 +12,4 @@ instance fooString :: Foo String where
1112 go :: String -> String
1213 go s = s
1314
14−main = Control.Monad.Eff.Console.log "Done"
15+main = log "Done"
examples/passing/LiberalTypeSynonyms.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56type Reader = (->) String
67
@@ -18,4 +19,4 @@ f :: (forall r. F r) -> String
1819f g = case g { x: "Hello" } of
1920 { x = x } -> x
2021
21−main = Control.Monad.Eff.Console.log "Done"
22+main = log "Done"
examples/passing/MPTCs.purs+3−2
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56class NullaryTypeClass where
67 greeting :: String
@@ -14,7 +15,7 @@ class Coerce a b where
1415instance coerceRefl :: Coerce a a where
1516 coerce a = a
1617
17−instance coerceShow :: (Prelude.Show a) => Coerce a String where
18+instance coerceShow :: Show a => Coerce a String where
1819 coerce = show
1920
20−main = Control.Monad.Eff.Console.log "Done"
21+main = log "Done"
examples/passing/Match.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Foo a = Foo
67
78foo = \f -> case f of Foo -> "foo"
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/Module.purs+2−1
@@ -2,5 +2,6 @@ module Main where
22
33import M1
44import M2
5+import Control.Monad.Eff.Console (log)
56
6−main = Control.Monad.Eff.Console.log "Done"
7+main = log "Done"
examples/passing/Module/M1.purs+1−1
@@ -4,7 +4,7 @@ import Prelude
44
55data Foo = Foo String
66
7−foo :: M1.Foo -> String
7+foo :: Foo -> String
88foo = \f -> case f of Foo s -> s <> "foo"
99
1010bar :: Foo -> String
examples/passing/Module/M2.purs+1
@@ -1,6 +1,7 @@
11module M2 where
22
33import Prelude
4+import M1 as M1
45
56baz :: M1.Foo -> String
67baz = M1.foo
examples/passing/ModuleDeps.purs+2−1
@@ -1,5 +1,6 @@
11module Main where
22
33import M1
4+import Control.Monad.Eff.Console (log)
45
5−main = Control.Monad.Eff.Console.log "Done"
6+main = log "Done"
examples/passing/ModuleDeps/M1.purs+1−1
@@ -1,5 +1,5 @@
11module M1 where
22
3−import M2
3+import M2 as M2
44
55foo = M2.bar
examples/passing/ModuleDeps/M2.purs+1−1
@@ -1,5 +1,5 @@
11module M2 where
22
3−import M3
3+import M3 as M3
44
55bar = M3.baz
examples/passing/Monad.purs+2−2
@@ -1,6 +1,6 @@
11module Main where
22
3−import Prelude ()
3+import Control.Monad.Eff.Console (log)
44
55type Monad m = { return :: forall a. a -> m a
66 , bind :: forall a b. m a -> (a -> m b) -> m b }
@@ -29,4 +29,4 @@ test1 = test id
2929
3030test2 = test maybe
3131
32−main = Control.Monad.Eff.Console.log "Done"
32+main = log "Done"
examples/passing/MutRec.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56f 0.0 = 0.0
67f x = g x + 0.0
@@ -16,4 +17,4 @@ evenToNumber (Even n) = oddToNumber n + 0.0
1617
1718oddToNumber (Odd n) = evenToNumber n + 0.0
1819
19−main = Control.Monad.Eff.Console.log "Done"
20+main = log "Done"
examples/passing/MutRec2.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data A = A B
67
@@ -16,4 +17,4 @@ g b = case b of B a -> f a
1617showN :: A -> S
1718showN a = f a
1819
19−main = Control.Monad.Eff.Console.log "Done"
20+main = log "Done"
examples/passing/MutRec3.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data A = A B
67
@@ -16,4 +17,4 @@ g b = case b of B a -> f a
1617showN :: A -> S
1718showN a = f a
1819
19−main = Control.Monad.Eff.Console.log "Done"
20+main = log "Done"
examples/passing/NamedPatterns.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56foo = \x -> case x of
67 y@{ foo = "Foo" } -> y
78 y -> y
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/NegativeBinder.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56test :: Number -> Boolean
67test -1.0 = false
78test _ = true
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/NegativeIntInRange.purs+2−1
@@ -1,8 +1,9 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56n :: Int
67n = -2147483648
78
8−main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/passing/Nested.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Extend r a = Extend { prev :: r a, next :: a }
67
78data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/NestedWhere.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56f x = g x
67 where
@@ -9,4 +10,4 @@ f x = g x
910 go x = go1 (x - 1.0)
1011 go1 x = go x
1112
12−main = Control.Monad.Eff.Console.log "Done"
13+main = log "Done"
examples/passing/NonConflictingExports.purs+5−4
@@ -1,9 +1,10 @@
11-- No failure here as the export `thing` only refers to Main.thing
22module Main (thing, main) where
33
4− import A
4+import A
5+import Control.Monad.Eff.Console (log)
56
6− thing :: Int
7− thing = 2
7+thing :: Int
8+thing = 2
89
9− main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/ObjectSynonym.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56type Inner = Number
67
@@ -12,4 +13,4 @@ type Outer = { inner :: Inner }
1213outer :: Outer
1314outer = { inner: inner }
1415
15−main = Control.Monad.Eff.Console.log "Done"
16+main = log "Done"
examples/passing/ObjectUpdate2.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56type X r = { | r }
67
@@ -14,4 +15,4 @@ test = blah x
1415 { baz = "blah"
1516 }
1617
17−main = Control.Monad.Eff.Console.log "Done"
18+main = log "Done"
examples/passing/Objects.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude hiding (append)
4+import Control.Monad.Eff.Console (log)
45
56test = \x -> x.foo + x.bar + 1.0
67
@@ -32,4 +33,4 @@ test6 = case { "***": 1.0 } of
3233
3334test7 {a: snoog , b : blah } = blah
3435
35−main = Control.Monad.Eff.Console.log "Done"
36+main = log "Done"
examples/passing/OneConstructor.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data One a = One a
67
78one' (One a) = a
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/Operators.purs+4−8
@@ -1,6 +1,8 @@
11module Main where
22
33import Prelude
4+import Other (foo)
5+import Other as Other
46import Control.Monad.Eff
57import Control.Monad.Eff.Console
68
@@ -9,9 +11,6 @@ op1 x _ = x
911
1012infix 4 op1 as ?!
1113
12−bar :: String -> String -> String
13−bar = \s1 s2 -> s1 <> s2
14−
1514test1 :: forall n. (Semiring n) => n -> n -> (n -> n -> n) -> n
1615test1 x y z = x * y + z x y
1716
@@ -44,14 +43,11 @@ op4 = \f x -> f x
4443
4544infix 4 op4 as @@
4645
47−foo :: String -> String
48−foo = \s -> s
49−
5046test8 = foo @@ "Hello World"
5147
52−test9 = Main.foo @@ "Hello World"
48+test9 = Other.foo @@ "Hello World"
5349
54−test10 = "Hello" `Main.bar` "World"
50+test10 = "Hello" `Other.baz` "World"
5551
5652op5 :: forall a. Array a -> Array a -> Array a
5753op5 = \as -> \bs -> as
examples/passing/Operators/Other.pursnew file+7
@@ -0,0 +1,7 @@
1+module Other where
2+
3+foo :: String -> String
4+foo s = s
5+
6+baz :: String -> String -> String
7+baz s _ = s
examples/passing/OptimizerBug.purs+2−1
@@ -1,9 +1,10 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56x a = 1.0 + y a
67
78y a = x a
89
9−main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/Patterns.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56test = \x -> case x of
67 { str = "Foo", bool = true } -> true
@@ -19,4 +20,4 @@ isDesc :: Array Number -> Boolean
1920isDesc [x, y] | x > y = true
2021isDesc _ = false
2122
22−main = Control.Monad.Eff.Console.log "Done"
23+main = log "Done"
examples/passing/PendingConflictingImports.purs+2−1
@@ -3,5 +3,6 @@ module Main where
33-- No error as we never force `thing` to be resolved in `Main`
44import A
55import B
6+import Control.Monad.Eff.Console (log)
67
7−main = Control.Monad.Eff.Console.log "Done"
8+main = log "Done"
examples/passing/PendingConflictingImports2.purs+6−5
@@ -1,9 +1,10 @@
11module Main where
22
3− import A
3+import A
4+import Control.Monad.Eff.Console (log)
45
5− -- No error as we never force `thing` to be resolved in `Main`
6− thing :: Int
7− thing = 2
6+-- No error as we never force `thing` to be resolved in `Main`
7+thing :: Int
8+thing = 2
89
9− main = Control.Monad.Eff.Console.log "Done"
10+main = log "Done"
examples/passing/QualifiedNames.purs+3−1
@@ -1,9 +1,11 @@
11module Main where
22
33import Prelude
4+import Either as Either
5+import Control.Monad.Eff.Console (log)
46
57either :: forall a b c. (a -> c) -> (b -> c) -> Either.Either a b -> c
68either f _ (Either.Left x) = f x
79either _ g (Either.Right y) = g y
810
9−main = Control.Monad.Eff.Console.log (either id id (Either.Left "Done"))
11+main = log (either id id (Either.Left "Done"))
examples/passing/Rank2Types.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56test1 :: (forall a. (a -> a)) -> Number
67test1 = \f -> f 0.0
@@ -8,4 +9,4 @@ test1 = \f -> f 0.0
89forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
910forever = \bind action -> bind action $ \_ -> forever bind action
1011
11−main = Control.Monad.Eff.Console.log "Done"
12+main = log "Done"
examples/passing/ReExportQualified.purs+2−1
@@ -2,5 +2,6 @@ module Main where
22
33import Prelude
44import C
5+import Control.Monad.Eff.Console (log)
56
6−main = Control.Monad.Eff.Console.log (x <> y)
7+main = log (x <> y)
examples/passing/Recursion.purs+2−1
@@ -1,10 +1,11 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56fib = \n -> case n of
67 0.0 -> 1.0
78 1.0 -> 1.0
89 n -> fib (n - 1.0) + fib (n - 2.0)
910
10−main = Control.Monad.Eff.Console.log "Done"
11+main = log "Done"
examples/passing/RedefinedFixity.purs+2−1
@@ -1,5 +1,6 @@
11module Main where
22
33import M3
4+import Control.Monad.Eff.Console (log)
45
5−main = Control.Monad.Eff.Console.log "Done"
6+main = log "Done"
examples/passing/ReservedWords.purs+2−1
@@ -3,6 +3,7 @@ module Main where
33
44import Prelude
55import Control.Monad.Eff
6+import Control.Monad.Eff.Console (log)
67
78o :: { type :: String }
89o = { type: "o" }
@@ -15,4 +16,4 @@ f { type = "p" } = "Done"
1516f _ = "Fail"
1617
1718main :: Eff _ _
18−main = Control.Monad.Eff.Console.log $ f { type: p.type, foo: "bar" }
19+main = log $ f { type: p.type, foo: "bar" }
examples/passing/ResolvableScopeConflict.purs+2−1
@@ -2,6 +2,7 @@ module Main where
22
33import A (thing)
44import B
5+import Control.Monad.Eff.Console (log)
56
67-- Not an error as although we have `thing` in scope from both A and B, it is
78-- imported explicitly from A, giving it a resolvable solution.
@@ -9,4 +10,4 @@ what :: Boolean -> Int
910what true = thing
1011what false = zing
1112
12−main = Control.Monad.Eff.Console.log "Done"
13+main = log "Done"
examples/passing/ResolvableScopeConflict2.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import A
4+import Control.Monad.Eff.Console (log)
45
56thing :: Int
67thing = 1
@@ -11,4 +12,4 @@ what :: Boolean -> Int
1112what true = thing
1213what false = zing
1314
14−main = Control.Monad.Eff.Console.log "Done"
15+main = log "Done"
examples/passing/ResolvableScopeConflict3.purs+2−1
@@ -1,8 +1,9 @@
11module Main (thing, main, module A) where
22
33import A
4+import Control.Monad.Eff.Console (log)
45
56thing :: Int
67thing = 2
78
8−main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/passing/RowConstructors.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56type Foo = (x :: Number | (y :: Number | (z :: Number)))
67type Bar = (x :: Number, y :: Number, z :: Number)
@@ -39,4 +40,4 @@ wildcard { w: w } = { x: w, y: w, z: w, w: w }
3940wildcard' :: { | Quux _ } -> Number
4041wildcard' { q: q } = q
4142
42−main = Control.Monad.Eff.Console.log "Done"
43+main = log "Done"
examples/passing/RowPolyInstanceContext.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56class T s m where
67 state :: (s -> s) -> m Unit
@@ -19,4 +20,4 @@ test2 = state $ \o -> o { foo = o.foo <> "!" }
1920main = do
2021 let t1 = test1
2122 let t2 = test2
22− Control.Monad.Eff.Console.log "Done"
23+ log "Done"
examples/passing/ScopedTypeVariables.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56test1 :: forall a. (a -> a) -> a -> a
67test1 f x = g (g x)
@@ -33,4 +34,4 @@ test4 = h
3334 j x = x
3435
3536
36−main = Control.Monad.Eff.Console.log "Done"
37+main = log "Done"
examples/passing/Sequence.purs+2−1
@@ -2,6 +2,7 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5+import Control.Monad.Eff.Console (log)
56
67data List a = Cons a (List a) | Nil
78
@@ -12,4 +13,4 @@ instance sequenceList :: Sequence List where
1213 sequence Nil = pure Nil
1314 sequence (Cons x xs) = Cons <$> x <*> sequence xs
1415
15−main = sequence $ Cons (Control.Monad.Eff.Console.log "Done") Nil
16+main = sequence $ Cons (log "Done") Nil
examples/passing/SequenceDesugared.purs+5−4
@@ -2,6 +2,7 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff
5+import Control.Monad.Eff.Console (log)
56
67data List a = Cons a (List a) | Nil
78
@@ -31,7 +32,7 @@ sequenceList''' = Sequence ((\val -> case val of
3132 Cons x xs -> Cons <$> x <*> sequence sequenceList''' xs) :: forall m a. (Monad m) => List (m a) -> m (List a))
3233
3334main = do
34− sequence sequenceList $ Cons (Control.Monad.Eff.Console.log "Done") Nil
35− sequence sequenceList' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
36− sequence sequenceList'' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
37− sequence sequenceList''' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
35+ sequence sequenceList $ Cons (log "Done") Nil
36+ sequence sequenceList' $ Cons (log "Done") Nil
37+ sequence sequenceList'' $ Cons (log "Done") Nil
38+ sequence sequenceList''' $ Cons (log "Done") Nil
examples/passing/ShadowedName.purs+2−1
@@ -2,9 +2,10 @@ module Main where
22
33import Prelude
44import Control.Monad.Eff.Console
5+import Control.Monad.Eff.Console (log)
56
67done :: String
78done = let str = "Not yet done" in
89 let str = "Done" in str
910
10−main = Control.Monad.Eff.Console.log done
11+main = log done
examples/passing/SignedNumericLiterals.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56p = 0.5
67q = 1.0
@@ -14,4 +15,4 @@ f x = -x
1415
1516test1 = 2.0 - 1.0
1617
17−main = Control.Monad.Eff.Console.log "Done"
18+main = log "Done"
examples/passing/TCOCase.purs+2−1
@@ -1,10 +1,11 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Data = One | More Data
67
7−main = Control.Monad.Eff.Console.log (from (to 10000.0 One))
8+main = log (from (to 10000.0 One))
89 where
910 to 0.0 a = a
1011 to n a = to (n - 1.0) (More a)
examples/passing/Tick.purs+2−1
@@ -1,7 +1,8 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56test' x = x
67
7−main = Control.Monad.Eff.Console.log "Done"
8+main = log "Done"
examples/passing/TopLevelCase.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56gcd :: Number -> Number -> Number
67gcd 0.0 x = x
@@ -15,4 +16,4 @@ data A = A
1516
1617parseTest A 0.0 = 0.0
1718
18−main = Control.Monad.Eff.Console.log "Done"
19+main = log "Done"
examples/passing/TransitiveImport/Middle.purs+3−1
@@ -1,3 +1,5 @@
11module Middle where
22
3−middle = Test.test
3+import Test (test)
4+
5+middle = test
examples/passing/TypeClasses.purs+3−3
@@ -5,19 +5,19 @@ import Control.Monad.Eff.Console (log)
55
66test1 = \_ -> show "testing"
77
8−f :: forall a. (Prelude.Show a) => a -> String
8+f :: forall a. (Show a) => a -> String
99f x = show x
1010
1111test2 = \_ -> f "testing"
1212
13−test7 :: forall a. (Prelude.Show a) => a -> String
13+test7 :: forall a. (Show a) => a -> String
1414test7 = show
1515
1616test8 = \_ -> show $ "testing"
1717
1818data Data a = Data a
1919
20−instance showData :: (Prelude.Show a) => Prelude.Show (Data a) where
20+instance showData :: (Show a) => Show (Data a) where
2121 show (Data a) = "Data (" <> show a <> ")"
2222
2323test3 = \_ -> show (Data "testing")
examples/passing/TypeClassesInOrder.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56class Foo a where
67 foo :: a -> String
@@ -8,4 +9,4 @@ class Foo a where
89instance fooString :: Foo String where
910 foo s = s
1011
11−main = Control.Monad.Eff.Console.log $ foo "Done"
12+main = log $ foo "Done"
examples/passing/TypeClassesWithOverlappingTypeVariables.purs+3−2
@@ -1,11 +1,12 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Either a b = Left a | Right b
67
7−instance functorEither :: Prelude.Functor (Either a) where
8+instance functorEither :: Functor (Either a) where
89 map _ (Left x) = Left x
910 map f (Right y) = Right (f y)
1011
11−main = Control.Monad.Eff.Console.log "Done"
12+main = log "Done"
examples/passing/TypeDecl.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56k :: String -> Number -> String
67k x y = x
@@ -9,4 +10,4 @@ iterate :: forall a. Number -> (a -> a) -> a -> a
910iterate 0.0 f a = a
1011iterate n f a = iterate (n - 1.0) f (f a)
1112
12−main = Control.Monad.Eff.Console.log "Done"
13+main = log "Done"
examples/passing/TypeOperators.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import A (type (~>), type (/\), (/\))
4+import Control.Monad.Eff.Console (log)
45
56natty ∷ ∀ f. f ~> f
67natty x = x
@@ -16,4 +17,4 @@ testPrecedence2 nat fx = nat fx
1617swap ∷ ∀ a b. a /\ b → b /\ a
1718swap (a /\ b) = b /\ a
1819
19−main = Control.Monad.Eff.Console.log "Done"
20+main = log "Done"
examples/passing/TypeSynonymInData.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56type A a = Array a
67
@@ -8,4 +9,4 @@ data Foo a = Foo (A a) | Bar
89
910foo (Foo []) = Bar
1011
11−main = Control.Monad.Eff.Console.log "Done"
12+main = log "Done"
examples/passing/TypeSynonyms.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56type Lens a b =
67 { get :: a -> b
@@ -24,4 +25,4 @@ fst =
2425test1 :: forall a b c. Lens (Pair (Pair a b) c) a
2526test1 = composeLenses fst fst
2627
27−main = Control.Monad.Eff.Console.log "Done"
28+main = log "Done"
examples/passing/TypeWildcards.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56testTopLevel :: _ -> _
67testTopLevel n = n + 1.0
@@ -12,4 +13,4 @@ test f a = go (f a) a
1213 go a1 a2 | a1 == a2 = a1
1314 go a1 _ = go (f a1) a1
1415
15−main = Control.Monad.Eff.Console.log "Done"
16+main = log "Done"
examples/passing/TypeWildcardsRecordExtension.purs+2−1
@@ -1,8 +1,9 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56foo :: forall a. {b :: Number | a} -> {b :: Number | _}
67foo f = f
78
8−main = Control.Monad.Eff.Console.log "Done"
9+main = log "Done"
examples/passing/TypeWithoutParens.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Lib (X, Y)
4+import Control.Monad.Eff.Console (log)
45
56idX :: X -> X
67idX x = x
@@ -8,4 +9,4 @@ idX x = x
89idY :: Y -> Y
910idY y = y
1011
11−main = Control.Monad.Eff.Console.log "Done"
12+main = log "Done"
examples/passing/TypedBinders.purs+3−2
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Tuple a b = Tuple a b
67
@@ -31,7 +32,7 @@ instance monadStateState :: MonadState s (State s) where
3132 get = State (\s -> Tuple s s)
3233 put s = State (\_ -> Tuple s {})
3334
34−modify :: forall m s. (Prelude.Monad m, MonadState s m) => (s -> s) -> m {}
35+modify :: forall m s. (Monad m, MonadState s m) => (s -> s) -> m {}
3536modify f = do
3637 s <- get
3738 put (f s)
@@ -64,4 +65,4 @@ main = do
6465 t2 = test2 id
6566 t3 = test3 1
6667 t4 = test4 (Tuple 1 0)
67− Control.Monad.Eff.Console.log "Done"
68+ log "Done"
examples/passing/TypedWhere.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data E a b = L a | R b
67
@@ -14,4 +15,4 @@ lefts = go N
1415 go ls (C (L a) rest) = go (C a ls) rest
1516 go ls (C _ rest) = go ls rest
1617
17−main = Control.Monad.Eff.Console.log "Done"
18+main = log "Done"
examples/passing/UnderscoreIdent.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56data Data_type = Con_Structor | Con_2 String
67
@@ -9,4 +10,4 @@ type Type_name = Data_type
910done (Con_2 s) = s
1011done _ = "Failed"
1112
12−main = Control.Monad.Eff.Console.log (done (Con_2 "Done"))
13+main = log (done (Con_2 "Done"))
examples/passing/UnicodeIdentifier.purs+3−1
@@ -1,5 +1,7 @@
11module Main where
22
3+import Control.Monad.Eff.Console (log)
4+
35f asgård = asgård
46
5−main = Control.Monad.Eff.Console.log (f "Done")
7+main = log (f "Done")
examples/passing/UnicodeOperators.purs+3−1
@@ -1,5 +1,7 @@
11module Main where
22
3+import Control.Monad.Eff.Console (log)
4+
35compose :: forall a b c. (b -> c) -> (a -> b) -> a -> c
46compose f g a = f (g a)
57
@@ -17,4 +19,4 @@ emptySet _ = true
1719
1820test2 = 1 ∈ emptySet
1921
20−main = Control.Monad.Eff.Console.log "Done"
22+main = log "Done"
examples/passing/UnknownInTypeClassLookup.purs+2−1
@@ -1,6 +1,7 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56class EQ a b
67
@@ -11,4 +12,4 @@ test _ _ = "Done"
1112
1213runTest a = test a a
1314
14−main = Control.Monad.Eff.Console.log $ runTest 0.0
15+main = log $ runTest 0.0
examples/passing/UntupledConstraints.purs+1−1
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Control.Monad.Eff.Console
4+import Control.Monad.Eff.Console (log)
55
66class Show a <= Nonsense a where
77 method :: a -> a
examples/passing/WildcardType.purs+2−3
@@ -1,7 +1,7 @@
11module Main where
22
33import Prelude
4−import Control.Monad.Eff.Console
4+import Control.Monad.Eff.Console (log)
55
66f1 :: (_ -> _) -> _
77f1 g = g 1
@@ -9,5 +9,4 @@ f1 g = g 1
99f2 :: _ -> _
1010f2 _ = "Done"
1111
12−main = Control.Monad.Eff.Console.log $ f1 f2
13−
12+main = log $ f1 f2
examples/passing/iota.purs+3−1
@@ -1,9 +1,11 @@
11module Main where
22
3+import Control.Monad.Eff.Console (log)
4+
35s = \x -> \y -> \z -> x z (y z)
46
57k = \x -> \y -> x
68
79iota = \x -> x s k
810
9−main = Control.Monad.Eff.Console.log "Done"
11+main = log "Done"
examples/passing/s.purs+2−1
@@ -1,7 +1,8 @@
11module Main where
22
33import Prelude
4+import Control.Monad.Eff.Console (log)
45
56s = \x y z -> x z (y z)
67
7−main = Control.Monad.Eff.Console.log "Done"
8+main = log "Done"
purescript.cabal+1
@@ -38,6 +38,7 @@ extra-source-files: examples/passing/*.purs
3838 , examples/passing/ModuleExportSelf/*.purs
3939 , examples/passing/NonConflictingExports/*.purs
4040 , examples/passing/OperatorAliasElsewhere/*.purs
41+ , examples/passing/Operators/*.purs
4142 , examples/passing/PendingConflictingImports/*.purs
4243 , examples/passing/PendingConflictingImports2/*.purs
4344 , examples/passing/QualifiedNames/*.purs
src/Language/PureScript/Linter/Imports.hs+5−2
@@ -60,7 +60,7 @@ lintImports (Module ss _ mn mdecls (Just mexports)) env usedImps = do
6060
6161 -- TODO: this needs some work to be easier to understand
6262
63− let scope = maybe nullImports (\(_, imps', _) -> imps') (M.lookup mn env)
63+ let scope = maybe primImports (\(_, imps', _) -> imps') (M.lookup mn env)
6464 usedImps' = foldr (elaborateUsed scope) usedImps exportedModules
6565 numOpenImports = getSum $ foldMap (Sum . countOpenImports) mdecls
6666 allowImplicit = numOpenImports == 1
@@ -159,9 +159,11 @@ lintImports (Module ss _ mn mdecls (Just mexports)) env usedImps = do
159159 elaborateUsed scope mne used =
160160 foldr go used
161161 $ extractByQual mne (importedTypeClasses scope) TyClassName
162+ ++ extractByQual mne (importedTypeOps scope) TyOpName
162163 ++ extractByQual mne (importedTypes scope) TyName
163164 ++ extractByQual mne (importedDataConstructors scope) DctorName
164165 ++ extractByQual mne (importedValues scope) IdentName
166+ ++ extractByQual mne (importedValueOps scope) ValOpName
165167 where
166168 go :: (ModuleName, Qualified Name) -> UsedImports -> UsedImports
167169 go (q, name) = M.alter (Just . maybe [name] (name :)) q
@@ -298,6 +300,7 @@ findUsedRefs env mni qn names =
298300 let
299301 classRefs = TypeClassRef <$> mapMaybe (getClassName <=< disqualifyFor qn) names
300302 valueRefs = ValueRef <$> mapMaybe (getIdentName <=< disqualifyFor qn) names
303+ valueOpRefs = ValueOpRef <$> mapMaybe (getValOpName <=< disqualifyFor qn) names
301304 typeOpRefs = TypeOpRef <$> mapMaybe (getTypeOpName <=< disqualifyFor qn) names
302305 types = mapMaybe (getTypeName <=< disqualifyFor qn) names
303306 dctors = mapMaybe (getDctorName <=< disqualifyFor qn) names
@@ -306,7 +309,7 @@ findUsedRefs env mni qn names =
306309 typesRefs
307310 = map (flip TypeRef (Just [])) typesWithoutDctors
308311 ++ map (\(ty, ds) -> TypeRef ty (Just ds)) (M.toList typesWithDctors)
309− in classRefs ++ typeOpRefs ++ typesRefs ++ valueRefs
312+ in classRefs ++ typeOpRefs ++ typesRefs ++ valueRefs ++ valueOpRefs
310313
311314 where
312315
src/Language/PureScript/Sugar/Names.hs+29−67
@@ -16,7 +16,7 @@ import Control.Monad.Error.Class (MonadError(..))
1616import Control.Monad.State.Lazy
1717import Control.Monad.Writer (MonadWriter(..), censor)
1818
19−import Data.List (find, nub)
19+import Data.List (nub)
2020import Data.Maybe (fromMaybe, mapMaybe)
2121import qualified Data.Map as M
2222import qualified Data.Set as S
@@ -65,9 +65,9 @@ desugarImportsWithEnv externs modules = do
6565 externsEnv env ExternsFile{..} = do
6666 let members = Exports{..}
6767 ss = internalModuleSourceSpan "<Externs>"
68− env' = M.insert efModuleName (ss, nullImports, members) env
68+ env' = M.insert efModuleName (ss, primImports, members) env
6969 fromEFImport (ExternsImport mn mt qmn) = (mn, [(Nothing, Just mt, qmn)])
70− imps <- foldM (resolveModuleImport env') nullImports (map fromEFImport efImports)
70+ imps <- foldM (resolveModuleImport env') primImports (map fromEFImport efImports)
7171 exps <- resolveExports env' ss efModuleName imps members efExports
7272 return $ M.insert efModuleName (ss, imps, exps) env
7373 where
@@ -101,7 +101,7 @@ desugarImportsWithEnv externs modules = do
101101 Just m' -> throwError . errorMessage $ RedefinedModule mn [envModuleSourceSpan m', ss]
102102 Nothing -> do
103103 members <- findExportable m
104− let env' = M.insert mn (ss, nullImports, members) env
104+ let env' = M.insert mn (ss, primImports, members) env
105105 (m', imps) <- resolveImports env' m
106106 exps <- maybe (return members) (resolveExports env' ss mn imps members) refs
107107 return (m' : ms, M.insert mn (ss, imps, exps) env)
@@ -110,7 +110,7 @@ desugarImportsWithEnv externs modules = do
110110 renameInModule' env m@(Module _ _ mn _ _) =
111111 warnAndRethrow (addHint (ErrorInModule mn)) $ do
112112 let (_, imps, exps) = fromMaybe (internalError "Module is missing in renameInModule'") $ M.lookup mn env
113− (m', used) <- flip runStateT M.empty $ renameInModule env imps (elaborateExports exps m)
113+ (m', used) <- flip runStateT M.empty $ renameInModule imps (elaborateExports exps m)
114114 lintImports m' env used
115115 return m'
116116
@@ -147,11 +147,10 @@ elaborateExports exps (Module ss coms mn decls refs) =
147147renameInModule
148148 :: forall m
149149 . (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState UsedImports m)
150− => Env
151− -> Imports
150+ => Imports
152151 -> Module
153152 -> m Module
154−renameInModule env imports (Module ss coms mn decls exps) =
153+renameInModule imports (Module ss coms mn decls exps) =
155154 Module ss coms mn <$> parU decls go <*> pure exps
156155 where
157156
@@ -219,10 +218,9 @@ renameInModule env imports (Module ss coms mn decls exps) =
219218 (,) s <$> (ConstructorBinder <$> updateDataConstructorName name pos <*> pure b)
220219 updateBinder s@(pos, _) (OpBinder op) =
221220 (,) s <$> (OpBinder <$> updateValueOpName op pos)
222− updateBinder s (TypedBinder t b) = do
223− (s'@ (span', _), b') <- updateBinder s b
224− t' <- updateTypesEverywhere span' t
225− return (s', TypedBinder t' b')
221+ updateBinder s@(pos, _) (TypedBinder t b) = do
222+ t' <- updateTypesEverywhere pos t
223+ return (s, TypedBinder t' b)
226224 updateBinder s v =
227225 return (s, v)
228226
@@ -244,82 +242,51 @@ renameInModule env imports (Module ss coms mn decls exps) =
244242 updateType :: Type -> m Type
245243 updateType (TypeOp name) = TypeOp <$> updateTypeOpName name pos
246244 updateType (TypeConstructor name) = TypeConstructor <$> updateTypeName name pos
247− updateType (ConstrainedType cs t) = ConstrainedType <$> updateConstraints pos cs <*> pure t
245+ updateType (ConstrainedType cs t) = ConstrainedType <$> traverse updateInConstraint cs <*> pure t
248246 updateType t = return t
247+ updateInConstraint :: Constraint -> m Constraint
248+ updateInConstraint (Constraint name ts info) =
249+ Constraint <$> updateClassName name pos <*> pure ts <*> pure info
249250
250251 updateConstraints :: Maybe SourceSpan -> [Constraint] -> m [Constraint]
251− updateConstraints pos = traverse (\(Constraint name ts info) ->
252− Constraint <$> updateClassName name pos
253− <*> traverse (updateTypesEverywhere pos) ts
254− <*> pure info)
252+ updateConstraints pos = traverse $ \(Constraint name ts info) ->
253+ Constraint
254+ <$> updateClassName name pos
255+ <*> traverse (updateTypesEverywhere pos) ts
256+ <*> pure info
255257
256258 updateTypeName
257259 :: Qualified (ProperName 'TypeName)
258260 -> Maybe SourceSpan
259261 -> m (Qualified (ProperName 'TypeName))
260− updateTypeName =
261− update (importedTypes imports) (resolveType . exportedTypes) TyName
262+ updateTypeName = update (importedTypes imports) TyName
262263
263264 updateTypeOpName
264265 :: Qualified (OpName 'TypeOpName)
265266 -> Maybe SourceSpan
266267 -> m (Qualified (OpName 'TypeOpName))
267− updateTypeOpName =
268− update (importedTypeOps imports) (resolve . exportedTypeOps) TyOpName
268+ updateTypeOpName = update (importedTypeOps imports) TyOpName
269269
270270 updateDataConstructorName
271271 :: Qualified (ProperName 'ConstructorName)
272272 -> Maybe SourceSpan
273273 -> m (Qualified (ProperName 'ConstructorName))
274− updateDataConstructorName =
275− update
276− (importedDataConstructors imports)
277− (resolveDctor . exportedTypes)
278− DctorName
274+ updateDataConstructorName = update (importedDataConstructors imports) DctorName
279275
280276 updateClassName
281277 :: Qualified (ProperName 'ClassName)
282278 -> Maybe SourceSpan
283279 -> m (Qualified (ProperName 'ClassName))
284− updateClassName =
285− update
286− (importedTypeClasses imports)
287− (resolve . exportedTypeClasses)
288− TyClassName
280+ updateClassName = update (importedTypeClasses imports) TyClassName
289281
290282 updateValueName :: Qualified Ident -> Maybe SourceSpan -> m (Qualified Ident)
291− updateValueName =
292− update (importedValues imports) (resolve . exportedValues) IdentName
283+ updateValueName = update (importedValues imports) IdentName
293284
294285 updateValueOpName
295286 :: Qualified (OpName 'ValueOpName)
296287 -> Maybe SourceSpan
297288 -> m (Qualified (OpName 'ValueOpName))
298− updateValueOpName =
299− update (importedValueOps imports) (resolve . exportedValueOps) ValOpName
300−
301− -- Used when performing an update to qualify values and classes with their
302− -- module of original definition.
303− resolve :: Ord a => M.Map a ModuleName -> a -> Maybe (Qualified a)
304− resolve as name = mkQualified name <$> name `M.lookup` as
305−
306− -- Used when performing an update to qualify types with their module of
307− -- original definition.
308− resolveType
309− :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ModuleName)
310− -> ProperName 'TypeName
311− -> Maybe (Qualified (ProperName 'TypeName))
312− resolveType tys name =
313− mkQualified name . snd <$> M.lookup name tys
314−
315− -- Used when performing an update to qualify data constructors with their
316− -- module of original definition.
317− resolveDctor
318− :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ModuleName)
319− -> ProperName 'ConstructorName
320− -> Maybe (Qualified (ProperName 'ConstructorName))
321− resolveDctor tys name =
322− mkQualified name . snd <$> find (elem name . fst) tys
289+ updateValueOpName = update (importedValueOps imports) ValOpName
323290
324291 -- Update names so unqualified references become qualified, and locally
325292 -- qualified references are replaced with their canoncial qualified names
@@ -327,12 +294,11 @@ renameInModule env imports (Module ss coms mn decls exps) =
327294 update
328295 :: (Ord a, Show a)
329296 => M.Map (Qualified a) [ImportRecord a]
330− -> (Exports -> a -> Maybe (Qualified a))
331297 -> (a -> Name)
332298 -> Qualified a
333299 -> Maybe SourceSpan
334300 -> m (Qualified a)
335− update imps getE toName qname@(Qualified mn' name) pos = positioned $
301+ update imps toName qname@(Qualified mn' name) pos = positioned $
336302 case (M.lookup qname imps, mn') of
337303
338304 -- We found the name in our imports, so we return the name for it,
@@ -354,13 +320,9 @@ renameInModule env imports (Module ss coms mn decls exps) =
354320 -- by qualified importing). If that's not the case, then we just need to
355321 -- check it refers to a symbol in another module.
356322 (Nothing, Just mn'') ->
357− case M.lookup mn'' env of
358− Nothing
359− | mn'' `S.member` importedVirtualModules imports -> throwUnknown
360− | otherwise ->
361− throwError . errorMessage .
362− UnknownName . Qualified Nothing $ ModName mn''
363− Just env' -> maybe throwUnknown return (getE (envModuleExports env') name)
323+ if mn'' `S.member` importedQualModules imports || mn'' `S.member` importedModules imports
324+ then throwUnknown
325+ else throwError . errorMessage . UnknownName . Qualified Nothing $ ModName mn''
364326
365327 -- If neither of the above cases are true then it's an undefined or
366328 -- unimported symbol.
src/Language/PureScript/Sugar/Names/Env.hs+24−8
@@ -2,7 +2,7 @@ module Language.PureScript.Sugar.Names.Env
22 ( ImportRecord(..)
33 , ImportProvenance(..)
44 , Imports(..)
5− , nullImports
5+ , primImports
66 , Exports(..)
77 , nullExports
88 , Env
@@ -58,6 +58,7 @@ data ImportProvenance
5858 = FromImplicit
5959 | FromExplicit
6060 | Local
61+ | Prim
6162 deriving (Eq, Ord, Show, Read)
6263
6364type ImportMap a = M.Map (Qualified a) [ImportRecord a]
@@ -98,18 +99,33 @@ data Imports = Imports
9899 --
99100 , importedModules :: S.Set ModuleName
100101 -- |
101− -- The names of "virtual" modules that come into existence when "import as"
102− -- is used.
102+ -- The "as" names of modules that have been imported qualified.
103103 --
104− , importedVirtualModules :: S.Set ModuleName
104+ , importedQualModules :: S.Set ModuleName
105105 } deriving (Show, Read)
106106
107−-- |
108−-- An empty 'Imports' value.
109−--
110107nullImports :: Imports
111108nullImports = Imports M.empty M.empty M.empty M.empty M.empty M.empty S.empty S.empty
112109
110+-- |
111+-- An 'Imports' value with imports for the `Prim` module.
112+--
113+primImports :: Imports
114+primImports =
115+ nullImports
116+ { importedTypes = M.fromList $ mkEntries `concatMap` M.keys primTypes
117+ , importedTypeClasses = M.fromList $ mkEntries `concatMap` M.keys primClasses
118+ }
119+ where
120+ mkEntries :: Qualified a -> [(Qualified a, [ImportRecord a])]
121+ mkEntries fullName@(Qualified _ name) =
122+ [ (fullName, [ImportRecord fullName primModuleName Prim])
123+ , (Qualified Nothing name, [ImportRecord fullName primModuleName Prim])
124+ ]
125+
126+primModuleName :: ModuleName
127+primModuleName = ModuleName [ProperName "Prim"]
128+
113129-- |
114130-- The exported declarations from a module.
115131--
@@ -186,7 +202,7 @@ primExports =
186202-- | Environment which only contains the Prim module.
187203primEnv :: Env
188204primEnv = M.singleton
189− (ModuleName [ProperName "Prim"])
205+ primModuleName
190206 (internalModuleSourceSpan "<Prim>", nullImports, primExports)
191207
192208-- |
src/Language/PureScript/Sugar/Names/Imports.hs+5−4
@@ -53,7 +53,7 @@ resolveImports env (Module ss coms currentModule decls exps) =
5353 imports' = M.map (map (\(ss', dt, mmn) -> (ss', Just dt, mmn))) imports
5454 scope = M.insert currentModule [(Nothing, Nothing, Nothing)] imports'
5555 (Module ss coms currentModule decls exps,) <$>
56− foldM (resolveModuleImport env) nullImports (M.toList scope)
56+ foldM (resolveModuleImport env) primImports (M.toList scope)
5757
5858-- | Constructs a set of imports for a single module import.
5959resolveModuleImport
@@ -74,9 +74,10 @@ resolveModuleImport env ie (mn, imps) = foldM go ie imps
7474 (throwError . errorMessage . UnknownName . Qualified Nothing $ ModName mn)
7575 (return . envModuleExports)
7676 (mn `M.lookup` env)
77− let virtualModules = importedVirtualModules ie'
78− ie'' = ie' { importedModules = S.insert mn (importedModules ie')
79− , importedVirtualModules = maybe virtualModules (`S.insert` virtualModules) impQual
77+ let impModules = importedModules ie'
78+ qualModules = importedQualModules ie'
79+ ie'' = ie' { importedModules = maybe (S.insert mn impModules) (const impModules) impQual
80+ , importedQualModules = maybe qualModules (`S.insert` qualModules) impQual
8081 }
8182 positioned $ resolveImport mn modExports ie'' impQual typ
8283 where
tests/support/bower.json+1−1
@@ -7,6 +7,6 @@
77 "purescript-functions": "1.0.0-rc.1",
88 "purescript-prelude": "1.0.0-rc.3",
99 "purescript-st": "1.0.0-rc.1",
10− "purescript-partial": "1.1.1"
10+ "purescript-partial": "1.1.2"
1111 }
1212}