Skip to content
This repository was archived by the owner on Oct 23, 2018. It is now read-only.

Commit b2c68bd

Browse files
committed
update to 0.12 and psc-package
1 parent cf0b510 commit b2c68bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+306
-477
lines changed

exercises/chapter10/src/Control/Monad/Eff/Alert.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
module Control.Monad.Eff.Alert where
1+
module Effect.Alert where
22

33
import Prelude
44

5-
import Control.Monad.Eff (kind Effect, Eff)
5+
import Effect (kind Effect, Effect)
66

77
foreign import data ALERT :: Effect
88

exercises/chapter10/src/Control/Monad/Eff/Storage.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
module Control.Monad.Eff.Storage where
1+
module Effect.Storage where
22

33
import Prelude
44

5-
import Control.Monad.Eff (kind Effect, Eff)
5+
import Effect (kind Effect, Effect)
66
import Data.Foreign (Foreign)
77

88
foreign import data STORAGE :: Effect

exercises/chapter10/src/Main.purs

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

33
import Prelude
44

5-
import Control.Monad.Eff (Eff)
6-
import Control.Monad.Eff.Alert (ALERT, alert)
7-
import Control.Monad.Eff.Console (CONSOLE, log)
8-
import Control.Monad.Eff.Storage (STORAGE, setItem, getItem)
5+
import Effect (Effect)
6+
import Effect.Alert (ALERT, alert)
7+
import Effect.Console (log)
8+
import Effect.Storage (STORAGE, setItem, getItem)
99
import Control.Monad.Except (runExcept)
1010
import DOM (DOM)
1111
import DOM.HTML (window)

exercises/chapter11/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
/output/
66
/node_modules/
77
/bower_components/
8+
.psc-package
9+
.psc-package

exercises/chapter11/bower.json

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "chapter2",
3+
"set": "psc-0.12.0-20180625-2",
4+
"source": "https://github.com/purescript/package-sets.git",
5+
"depends": [
6+
"node-readline",
7+
"ordered-collections",
8+
"strings",
9+
"transformers",
10+
"yargs"
11+
]
12+
}

exercises/chapter11/src/Game.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Data.Map as M
66
import Data.Set as S
77
import Control.Monad.RWS (RWS)
88
import Control.Monad.Reader.Class (ask)
9-
import Control.Monad.State.Class (get, modify, put)
9+
import Control.Monad.State.Class (get, modify_, put)
1010
import Control.Monad.Writer.Class (tell)
1111
import Data.Coords (Coords(..), prettyPrintCoords, coords)
1212
import Data.Foldable (for_)
@@ -42,7 +42,7 @@ pickUp item = do
4242
_ -> tell (L.singleton "I don't see that item here.")
4343

4444
move :: Int -> Int -> Game Unit
45-
move dx dy = modify (\(GameState state) -> GameState (state { player = updateCoords state.player }))
45+
move dx dy = modify_ (\(GameState state) -> GameState (state { player = updateCoords state.player }))
4646
where
4747
updateCoords :: Coords -> Coords
4848
updateCoords (Coords p) = coords (p.x + dx) (p.y + dy)

exercises/chapter11/src/Main.purs

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

33
import Prelude
44
import Node.ReadLine as RL
5-
import Control.Monad.Eff (Eff)
6-
import Control.Monad.Eff.Console (CONSOLE, log)
7-
import Control.Monad.Eff.Exception (EXCEPTION)
5+
import Effect (Effect)
6+
import Effect.Console (log)
87
import Control.Monad.RWS (RWSResult(..), runRWS)
98
import Data.Either (Either(..))
109
import Data.Foldable (for_)
@@ -18,13 +17,8 @@ import Node.Yargs.Applicative (Y, runY, flag, yarg)
1817
import Node.Yargs.Setup (usage)
1918

2019
runGame
21-
:: forall eff
22-
. GameEnvironment
23-
-> Eff ( exception :: EXCEPTION
24-
, readline :: RL.READLINE
25-
, console :: CONSOLE
26-
| eff
27-
) Unit
20+
:: GameEnvironment
21+
-> Effect Unit
2822
runGame env = do
2923
interface <- RL.createConsoleInterface RL.noCompletion
3024
RL.setPrompt "> " 2 interface
@@ -33,11 +27,7 @@ runGame env = do
3327
lineHandler
3428
:: GameState
3529
-> String
36-
-> Eff ( exception :: EXCEPTION
37-
, console :: CONSOLE
38-
, readline :: RL.READLINE
39-
| eff
40-
) Unit
30+
-> Effect Unit
4131
lineHandler currentState input = do
4232
case runRWS (game (split (wrap " ") input)) env currentState of
4333
RWSResult state _ written -> do
@@ -51,10 +41,7 @@ runGame env = do
5141

5242
pure unit
5343

54-
main :: Eff ( exception :: EXCEPTION
55-
, console :: CONSOLE
56-
, readline :: RL.READLINE
57-
) Unit
44+
main :: Effect Unit
5845
main = runY (usage "$0 -p <player name>") $ map runGame env
5946
where
6047
env :: Y GameEnvironment

exercises/chapter12/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/output/
66
/node_modules/
77
/bower_components/
8+
.psc-package

exercises/chapter12/bower.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)