Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ cabal.sandbox.config
bower_components/
tmp/
.stack-work/
tests/support/flattened/
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Please follow the following guidelines:
- Add at least a test to `examples/passing/` and possibly to `examples/failing`.
- Build the binaries and libs with `cabal build`
- Install the binaries and libs with `cabal install`.
- Run `cabal configure --enable-tests && cabal build && cabal test` to build the test suite.
- Build the core libraries by running the script in `core-tests`
- Run `cabal configure --enable-tests && cabal build && cabal test` to build the test suite. You will need `npm`, `node`, and `bower` on your PATH to run the tests.
- Build the core libraries by running the script in `core-tests`.

If you would like to contribute, please consider the issues in the current milestone first. If you are a new contributor, you may want to have a go at the ["easy" issues](https://github.com/purescript/purescript/labels/easy) to get started.

Expand Down
2 changes: 1 addition & 1 deletion examples/failing/ArrayType.purs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Main where

import Prelude
import Debug.Trace
import Control.Monad.Eff.Console

bar :: Number -> Number -> Number
bar n m = n + m
Expand Down
4 changes: 2 additions & 2 deletions examples/failing/Eff.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module Main where
import Prelude
import Control.Monad.Eff
import Control.Monad.ST
import Debug.Trace
import Control.Monad.Eff.Console

test = pureST (do
ref <- newSTRef 0
trace "ST"
log "ST"
modifySTRef ref $ \n -> n + 1
readSTRef ref)
9 changes: 9 additions & 0 deletions examples/failing/ExtraRecordField.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

module ExtraRecordField where

import Prelude ((<>))

full :: { first :: String, last :: String } -> String
full p = p.first <> " " <> p.last

oops = full { first: "Jane", last: "Smith", age: 29 }
10 changes: 10 additions & 0 deletions examples/failing/MissingRecordField.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

module MissingRecordField where

import Prelude ((>))

john = { first: "John", last: "Smith" }

isOver50 p = p.age > 50.0

result = isOver50 john
2 changes: 1 addition & 1 deletion examples/failing/OverlappingInstances.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ instance showA1 :: Show A where
instance showA2 :: Show A where
show A = "Instance 2"

main = Debug.Trace.trace $ show A
main = Control.Monad.Eff.Console.log $ show A
2 changes: 1 addition & 1 deletion examples/failing/OverlappingInstances2.purs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ instance ordA :: Ord A where
test :: forall a. (Ord a) => a -> a -> String
test x y = show $ x == y

main = Debug.Trace.trace $ test A B
main = Control.Monad.Eff.Console.log $ test A B
2 changes: 1 addition & 1 deletion examples/failing/RowConstructors1.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Prelude
data Foo = Bar
type Baz = { | Foo }

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/failing/RowConstructors2.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Prelude
type Foo r = (x :: Number | r)
type Bar = { | Foo }

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/failing/RowConstructors3.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Prelude
type Foo = { x :: Number }
type Bar = { | Foo }

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/failing/UnderscoreModuleName.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module Bad_Module where

import Prelude

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/manual/QualifiedNames.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ either :: forall a b c. (a -> c) -> (b -> c) -> Data.Either.Either a b -> c
either f _ (Data.Either.Left x) = f x
either _ g (Data.Either.Right y) = g y

main = Debug.Trace.trace (either id id (Data.Either.Left "Done"))
main = Control.Monad.Eff.Console.log (either id id (Data.Either.Left "Done"))
2 changes: 1 addition & 1 deletion examples/manual/failing/ExportExplicit1.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ module Main where
-- should fail as Y constructor is not exported from M1
testY = Y

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/manual/failing/ExportExplicit3.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ module Main where
-- should fail as Z is not exported from M1
testZ = M1.Z

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/manual/passing/ExportExplicit.purs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ module Main where
testZ = Z
testFoo = foo

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/manual/passing/ExportExplicit2.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ module Main where

testBar = bar

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/manual/passing/Import.purs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ module M2 where

module Main where

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/manual/passing/ImportExplicit.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ module Main where
testX = X
testY = Y

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
6 changes: 3 additions & 3 deletions examples/manual/passing/ImportQualified.purs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module M1 where

trace x = x
log x = x

module Main where

import Prelude
import Control.Monad.Eff
import M1
import qualified Debug.Trace as T
import qualified Control.Monad.Eff.Console as C

main = T.trace (trace "Done")
main = C.log (log "Done")
2 changes: 1 addition & 1 deletion examples/manual/passing/Module.purs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ module M2 where

module Main where

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/manual/passing/ModuleDeps.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ baz = 1

module Main where

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/manual/passing/RedefinedFixity.purs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ import M2

module Main where

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
4 changes: 2 additions & 2 deletions examples/manual/passing/ShadowedName.purs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Main where

import Prelude
import Debug.Trace
import Control.Monad.Eff.Console

done :: String
done = let str = "Not yet done" in
let str = "Done" in str

main = Debug.Trace.trace done
main = Control.Monad.Eff.Console.log done
2 changes: 1 addition & 1 deletion examples/manual/passing/TransitiveImport.purs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Main where

import Prelude
import Middle
import Debug.Trace
import Control.Monad.Eff.Console

main = do
print (middle unit)
Expand Down
4 changes: 2 additions & 2 deletions examples/manual/passing/WildcardType.purs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module Main where

import Prelude
import Debug.Trace
import Control.Monad.Eff.Console

f1 :: (_ -> _) -> _
f1 g = g 1

f2 :: _ -> _
f2 _ = "Done"

main = Debug.Trace.trace $ f1 f2
main = Control.Monad.Eff.Console.log $ f1 f2

2 changes: 1 addition & 1 deletion examples/passing/652.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ instance bar :: Bar (a -> b) b

instance baz :: (Eq a) => Baz (a -> b) a b

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/passing/810.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ test m = o.x
o = case m of Nothing -> { x : Nothing }
Just a -> { x : Just a }

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
8 changes: 4 additions & 4 deletions examples/passing/Applicative.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import Prelude ()

class Applicative f where
pure :: forall a. a -> f a
(<*>) :: forall a b. f (a -> b) -> f a -> f b
apply :: forall a b. f (a -> b) -> f a -> f b

data Maybe a = Nothing | Just a

instance applicativeMaybe :: Applicative Maybe where
pure = Just
(<*>) (Just f) (Just a) = Just (f a)
(<*>) _ _ = Nothing
apply (Just f) (Just a) = Just (f a)
apply _ _ = Nothing

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/passing/ArrayType.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class Pointed p where
instance pointedArray :: Pointed Array where
point a = [a]

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/passing/Auto.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ exists = \state step f -> f (Auto { state: state, step: step })
run :: forall i o. SomeAuto i o -> i -> o
run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
4 changes: 2 additions & 2 deletions examples/passing/AutoPrelude.purs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Main where

import Prelude
import Debug.Trace
import Control.Monad.Eff.Console

f x = x * 10.0
g y = y - 10.0

main = trace $ show $ (f <<< g) 100.0
main = log $ show $ (f <<< g) 100.0
4 changes: 2 additions & 2 deletions examples/passing/AutoPrelude2.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module Main where

import Prelude
import qualified Prelude as P
import Debug.Trace
import Control.Monad.Eff.Console

f :: forall a. a -> a
f = P.id

main = P.($) trace ((f P.<<< f) "Done")
main = P.($) log ((f P.<<< f) "Done")
11 changes: 5 additions & 6 deletions examples/passing/BindersInFunctions.purs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
module Main where

import Prelude
import Assert
import Test.Assert

snd = \[_, y] -> y

main =
let ts = snd [1.0, 2.0] in
if ts == 2.0
then Debug.Trace.trace "Done"
else error "Incorrect result from 'snd'."
main = do
let ts = snd [1.0, 2.0]
assert' "Incorrect result from 'snd'." (ts == 2.0)
Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/passing/BindingGroups.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ foo = bar

r = foo 2.0

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/passing/BlockString.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Prelude
foo :: String
foo = """foo"""

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
6 changes: 3 additions & 3 deletions examples/passing/CaseInDo.purs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module Main where

import Prelude
import Debug.Trace
import Control.Monad.Eff.Console
import Control.Monad.Eff

doIt :: forall eff. Eff eff Boolean
doIt = return true

set = do
trace "Testing..."
log "Testing..."
case 0 of
0 -> doIt
_ -> return false

main = do
b <- set
case b of
true -> trace "Done"
true -> log "Done"
2 changes: 1 addition & 1 deletion examples/passing/CaseStatement.purs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ h f N a = a
h f a N = a
h f (J a) (J b) = J (f a b)

main = Debug.Trace.trace $ f "Done" "Failed" A
main = Control.Monad.Eff.Console.log $ f "Done" "Failed" A
2 changes: 1 addition & 1 deletion examples/passing/CheckFunction.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import Prelude

test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
5 changes: 4 additions & 1 deletion examples/passing/CheckSynonymBug.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ module Main where

import Prelude

length :: forall a. Array a -> Int
length _ = 0

type Foo a = Array a

foo _ = length ([] :: Foo Number)

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
2 changes: 1 addition & 1 deletion examples/passing/CheckTypeClass.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ foo_ x = foo ((mkBar :: forall a. (Foo a) => a -> Bar a) x)
mkBar :: forall a. a -> Bar a
mkBar _ = Bar

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"

2 changes: 1 addition & 1 deletion examples/passing/Church.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ append = \l1 l2 r f -> l2 (l1 r f) f

test = append (cons 1 empty) (cons 2 empty)

main = Debug.Trace.trace "Done"
main = Control.Monad.Eff.Console.log "Done"
12 changes: 6 additions & 6 deletions examples/passing/Collatz.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import Prelude
import Control.Monad.Eff
import Control.Monad.ST

collatz :: Number -> Number
collatz :: Int -> Int
collatz n = runPure (runST (do
r <- newSTRef n
count <- newSTRef 0.0
count <- newSTRef 0
untilE $ do
modifySTRef count $ (+) 1.0
modifySTRef count $ (+) 1
m <- readSTRef r
writeSTRef r $ if m % 2.0 == 0.0 then m / 2.0 else 3.0 * m + 1.0
return $ m == 1.0
writeSTRef r $ if m `mod` 2 == 0 then m / 2 else 3 * m + 1
return $ m == 1
readSTRef count))

main = Debug.Trace.print $ collatz 1000.0
main = Control.Monad.Eff.Console.print $ collatz 1000
Loading