Skip to content

Commit 52c8f08

Browse files
authored
Merge pull request #1 from cryogenian/compiler/0.12
0.12 updates
2 parents afcd9d3 + b831386 commit 52c8f08

File tree

5 files changed

+44
-45
lines changed

5 files changed

+44
-45
lines changed

bower.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@
88
"example"
99
],
1010
"dependencies": {
11-
"purescript-prelude": "^3.1.1",
12-
"purescript-console": "^3.0.0",
13-
"purescript-optlicative": "https://github.com/Thimoteus/purescript-optlicative.git#^4.0.2",
14-
"purescript-mote": "^0.1.0",
15-
"purescript-validation": "^3.2.0",
16-
"purescript-node-process": "^5.0.0",
17-
"purescript-eff": "^3.2.0",
18-
"purescript-record": "^0.2.6"
11+
"purescript-prelude": "^4.0.0",
12+
"purescript-console": "^4.1.0",
13+
"purescript-optlicative": "^5.0.0",
14+
"purescript-validation": "^4.0.0",
15+
"purescript-node-process": "^6.0.0",
16+
"purescript-record": "^1.0.0",
17+
"purescript-mote": "cryogenian/purescript-mote#compiler/0.12"
1918
},
2019
"devDependencies": {
21-
"purescript-psci-support": "^3.0.0",
22-
"purescript-test-unit": "^13.0.0",
23-
"purescript-node-fs-aff": "^5.0.0"
20+
"purescript-psci-support": "^4.0.0",
21+
"purescript-test-unit": "^14.0.0",
22+
"purescript-node-fs-aff": "^6.0.0"
2423
}
2524
}

example/Main.purs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ module Main where
22

33
import Prelude
44

5-
import Control.Monad.Aff (Aff, launchAff_)
6-
import Control.Monad.Eff (Eff)
5+
import Effect.Aff (Aff, launchAff_)
6+
import Effect (Effect)
77
import Control.Monad.Trans.Class (lift)
88
import Data.String as String
99
import Data.Traversable (for_, sequence_)
@@ -21,9 +21,7 @@ import Test.Unit.Output.Fancy as Fancy
2121
theCommutativeProperty Int Int Result
2222
theCommutativeProperty a b = (a + b) === (b + a)
2323

24-
suite
25-
bracket eff eff1
26-
. MoteT bracket (Test eff) (Aff (fs FS.FS | eff1)) Unit
24+
suite bracket. MoteT bracket Test Aff Unit
2725
suite = do
2826
test "basic asserts" do
2927
Assert.assert "wasn't true" true
@@ -41,16 +39,13 @@ suite = do
4139
TU.failure "This one fails"
4240

4341
-- | interpret runs a `Plan` to produce a `TestSuite`
44-
interpret
45-
bracket eff
46-
. Plan bracket (Test eff)
47-
TestSuite eff
42+
interpret bracket. Plan bracket Test TestSuite
4843
interpret =
4944
foldPlan
5045
(\ { label, value } -> TU.test label value)
5146
(\label -> TU.testSkip label (pure unit))
5247
(\ { label, value } -> TU.suite label (interpret value))
5348
sequence_
5449

55-
main e. Eff _ Unit
50+
main Effect Unit
5651
main = launchAff_ (moteTCli (runTestWith Fancy.runTest <<< interpret) suite)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"example:run": "node example/run.js"
66
},
77
"dependencies": {
8-
"pulp": "^12.0.1",
9-
"purescript": "^0.11.7"
8+
"pulp": "^12.2.0",
9+
"purescript": "slamdata/node-purescript#0.12"
1010
}
1111
}

src/MoteRunner.purs

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,57 @@ module MoteRunner (moteCli, moteTCli) where
22

33
import Prelude
44

5-
import Control.Monad.Eff.Class (class MonadEff, liftEff)
6-
import Control.Monad.Eff.Console (CONSOLE, log)
75
import Control.MonadPlus (guard)
86
import Data.Array as Array
97
import Data.Either (Either(..))
108
import Data.Maybe (Maybe(..), maybe)
119
import Data.Traversable (for_)
10+
import Effect.Class (class MonadEffect, liftEffect)
11+
import Effect.Console (log)
1212
import Mote.Monad (MoteT, Mote)
1313
import Mote.Monad as MoteM
1414
import Mote.Plan (Plan(..), PlanItem, foldPlan)
1515
import Mote.Plan as Plan
1616
import MoteRunner.Options (Config, parseConfig)
17-
import Node.Process (PROCESS)
1817
import Node.Process as Process
1918

2019
-- | Accepts a `MoteT` suite of tests, an interpreter and returns a command-line
2120
-- | application that supports running individual tests, and inspection of the
2221
-- | test plan.
2322
moteCli
24-
void void' test bracket m e
25-
. MonadEff (process PROCESS, console CONSOLE | e) m
23+
void void' test bracket m
24+
. MonadEffect m
2625
(Plan bracket test m void)
2726
Mote bracket test void'
2827
m Unit
2928
moteCli interpret suite = do
3029
config ← getConfig
3130
let plan = filterPlanM config.pattern (MoteM.plan suite)
3231
if config.list
33-
then liftEff (for_ (listPlan plan) log)
32+
then liftEffect (for_ (listPlan plan) log)
3433
else void (interpret plan)
3534

3635
-- | Like moteCli, but supports effectful construction of the test plan in MonadEff.
3736
moteTCli
38-
bracket test void void' e m
39-
. MonadEff (process PROCESS, console CONSOLE | e) m
37+
bracket test void void' m
38+
. MonadEffect m
4039
(Plan.Plan bracket test m void')
4140
MoteT bracket test m void
4241
m Unit
4342
moteTCli interpret suite = do
4443
config ← getConfig
4544
plan ← filterPlanM config.pattern <$> MoteM.planT suite
4645
if config.list
47-
then liftEff (for_ (listPlan plan) log)
46+
then liftEffect (for_ (listPlan plan) log)
4847
else void (interpret plan)
4948

5049
getConfig
51-
m e
52-
. MonadEff (process PROCESS, console CONSOLE | e) m
50+
m
51+
. MonadEffect m
5352
m Config
5453
getConfig = do
55-
liftEff parseConfig >>= case _ of
56-
Left err → liftEff do
54+
liftEffect parseConfig >>= case _ of
55+
Left err → liftEffect do
5756
log err
5857
Process.exit 1
5958
Right config →
@@ -66,11 +65,20 @@ listPlan = foldPlan
6665
(\ { label, value } -> map ((label <> "/") <> _) (listPlan value))
6766
join
6867

69-
filterPlanM bracket test. Maybe String Plan bracket test Plan bracket test
70-
filterPlanM = maybe id filterPlan
68+
filterPlanM
69+
bracket test
70+
. Maybe String
71+
Plan bracket test
72+
Plan bracket test
73+
filterPlanM = maybe identity filterPlan
7174

72-
filterPlan bracket test. String Plan bracket test Plan bracket test
73-
filterPlan pattern (Plan items) = Plan (Array.mapMaybe (shouldKeep pattern) items)
75+
filterPlan
76+
bracket test
77+
. String
78+
Plan bracket test
79+
Plan bracket test
80+
filterPlan pattern (Plan items) =
81+
Plan (Array.mapMaybe (shouldKeep pattern) items)
7482

7583
unPlan bracket test. Plan bracket test Array (PlanItem bracket test)
7684
unPlan (Plan p) = p

src/MoteRunner/Options.purs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@ module MoteRunner.Options where
22

33
import Prelude
44

5-
import Control.Monad.Eff (Eff)
5+
import Effect (Effect)
66
import Data.Either (Either(..))
77
import Data.Maybe (Maybe(..))
88
import Data.Validation.Semigroup (unV)
99
import Node.Optlicative (Optlicative, defaultPreferences, flag, optional, optlicate, renderErrors, string)
10-
import Node.Process (PROCESS)
1110

1211
type Config =
1312
{ pattern Maybe String
1413
, list Boolean
1514
}
1615

17-
parseConfig
18-
e
19-
. Eff (process PROCESS | e) (Either String Config)
16+
parseConfig Effect (Either String Config)
2017
parseConfig = do
2118
{ value } ← optlicate {} (defaultPreferences { globalOpts = parseConfig' })
2219
pure $ unV (Left <<< renderErrors) Right value

0 commit comments

Comments
 (0)