Skip to content

Commit 003779d

Browse files
authored
Merge pull request #76 from jqyu/bump
Bumps dependencies for 2.0 release [WIP]
2 parents 91745ac + ed70a65 commit 003779d

25 files changed

+91
-74
lines changed

bower.json

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,26 @@
2424
"package.json"
2525
],
2626
"dependencies": {
27-
"purescript-arrays": "^1.0.0",
28-
"purescript-distributive": "^1.0.0",
29-
"purescript-lazy": "^1.0.0",
30-
"purescript-tailrec": "^1.0.0",
31-
"purescript-unfoldable": "^1.0.0"
27+
"purescript-arrays": "^1.1.0",
28+
"purescript-lazy": "^2.0.0",
29+
"purescript-tailrec": "^2.0.0",
30+
"purescript-unfoldable": "^1.1.0",
31+
"purescript-distributive": "bump",
32+
"purescript-tuples": "^3.0.0"
3233
},
3334
"devDependencies": {
34-
"purescript-console": "^1.0.0"
35+
"purescript-console": "^2.0.0"
36+
},
37+
"resolutions": {
38+
"purescript-tuples": "^3.0.0",
39+
"purescript-monoid": "^2.0.0",
40+
"purescript-foldable-traversable": "^2.0.0",
41+
"purescript-st": "^2.0.0",
42+
"purescript-eff": "^2.0.0",
43+
"purescript-control": "^2.0.0",
44+
"purescript-bifunctors": "^2.0.0",
45+
"purescript-invariant": "^2.0.0",
46+
"purescript-maybe": "^2.0.0",
47+
"purescript-prelude": "^2.1.0"
3548
}
3649
}

src/Control/Comonad/Env.purs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import Prelude
1515
import Control.Comonad.Env.Class (class ComonadEnv, ask, asks, local)
1616
import Control.Comonad.Env.Trans (EnvT(..), mapEnvT, runEnvT, withEnvT)
1717

18-
import Data.Identity (Identity(..), runIdentity)
18+
import Data.Identity (Identity(..))
19+
import Data.Newtype (unwrap)
1920
import Data.Tuple (Tuple(..))
2021

2122
-- | The `Env` comonad is a synonym for the `EnvT` comonad transformer, applied
@@ -24,7 +25,7 @@ type Env e = EnvT e Identity
2425

2526
-- | Unwrap a value in the `Env` comonad.
2627
runEnv :: forall e a. Env e a -> Tuple e a
27-
runEnv (EnvT x) = runIdentity <$> x
28+
runEnv (EnvT x) = unwrap <$> x
2829

2930
-- | Change the environment type in an `Env` computation.
3031
withEnv :: forall e1 e2 a. (e1 -> e2) -> Env e1 a -> Env e2 a

src/Control/Comonad/Env/Class.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Data.Tuple (Tuple(..), fst)
2020
-- | - `ask (local f x) = f (ask x)`
2121
-- | - `extract (local _ x) = extract a`
2222
-- | - `extend g (local f x) = extend (g <<< local f) x`
23-
class Comonad w <= ComonadEnv e w where
23+
class Comonad w <= ComonadEnv e w | w -> e where
2424
ask :: forall a. w a -> e
2525
local :: forall a. (e -> e) -> w a -> w a
2626

src/Control/Comonad/Store.purs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import Prelude
1313
import Control.Comonad.Store.Class (class ComonadStore, experiment, peek, peeks, pos, seek, seeks)
1414
import Control.Comonad.Store.Trans (StoreT(..), runStoreT)
1515

16-
import Data.Identity (Identity(..), runIdentity)
16+
import Data.Identity (Identity(..))
17+
import Data.Newtype (unwrap)
1718
import Data.Tuple (Tuple(..), swap)
1819

1920
-- | The `Store` comonad is a synonym for the `StoreT` comonad transformer, applied
@@ -22,7 +23,7 @@ type Store s a = StoreT s Identity a
2223

2324
-- | Unwrap a value in the `Store` comonad.
2425
runStore :: forall s a. Store s a -> Tuple (s -> a) s
25-
runStore (StoreT s) = swap (runIdentity <$> swap s)
26+
runStore (StoreT s) = swap (unwrap <$> swap s)
2627

2728
-- | Create a value in context in the `Store` comonad.
2829
store :: forall s a. (s -> a) -> s -> Store s a

src/Control/Comonad/Store/Class.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import Data.Tuple (Tuple(..))
2929
-- | blur :: forall w. (ComonadStore Number w) -> w Number -> w Number
3030
-- | blur = extend \r -> (peeks (\n -> n - 1) r + peeks (\n -> n + 1) r) / 2)
3131
-- | ```
32-
class Comonad w <= ComonadStore s w where
32+
class Comonad w <= ComonadStore s w | w -> s where
3333
pos :: forall a. w a -> s
3434
peek :: forall a. s -> w a -> a
3535

src/Control/Comonad/Traced.purs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ import Prelude
1313
import Control.Comonad.Traced.Class (class ComonadTraced, censor, listen, listens, track, tracks)
1414
import Control.Comonad.Traced.Trans (TracedT(..), runTracedT)
1515

16-
import Data.Identity (Identity(..), runIdentity)
16+
import Data.Identity (Identity(..))
17+
import Data.Newtype (unwrap)
1718

1819
-- | The `Traced` comonad is a synonym for the `TracedT` comonad transformer, applied
1920
-- | to the `Identity` monad.
2021
type Traced m = TracedT m Identity
2122

2223
-- | Unwrap a value in the `Traced` comonad.
2324
runTraced :: forall m a. Traced m a -> m -> a
24-
runTraced (TracedT t) = runIdentity t
25+
runTraced (TracedT t) = unwrap t
2526

2627
-- | Create a value in context in the `Traced` comonad.
2728
traced :: forall m a. (m -> a) -> Traced m a

src/Control/Comonad/Traced/Class.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import Data.Tuple (Tuple(..))
2828
-- | blur :: forall w. (ComonadTraced (Additive Number) w) -> w Number -> w Number
2929
-- | blur = extend \r -> (track (Additive (-1)) r + track (Additive 1) r) / 2
3030
-- | ```
31-
class Comonad w <= ComonadTraced t w where
31+
class Comonad w <= ComonadTraced t w | w -> t where
3232
track :: forall a. t -> w a -> a
3333

3434
-- | Extracts a value at a relative position which depends on the current value.

src/Control/Monad/Cont.purs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,25 @@ import Prelude
1313
import Control.Monad.Cont.Class (class MonadCont, callCC)
1414
import Control.Monad.Cont.Trans (class MonadTrans, ContT(..), lift, mapContT, runContT, withContT)
1515

16-
import Data.Identity (Identity(..), runIdentity)
16+
import Data.Identity (Identity(..))
17+
import Data.Newtype (unwrap)
1718

1819
-- | The `Cont` monad is a synonym for the `ContT` monad transformer applied to
1920
-- | the `Identity` monad.
2021
type Cont r a = ContT r Identity a
2122

2223
-- | Creates a computation in the `Cont` monad.
2324
cont :: forall a r. ((a -> r) -> r) -> Cont r a
24-
cont f = ContT (\c -> Identity (f (runIdentity <<< c)))
25+
cont f = ContT (\c -> Identity (f (unwrap <<< c)))
2526

2627
-- | Runs a computation in the `Cont` monad.
2728
runCont :: forall r a. ContT r Identity a -> (a -> r) -> r
28-
runCont cc k = runIdentity (runContT cc (Identity <<< k))
29+
runCont cc k = unwrap (runContT cc (Identity <<< k))
2930

3031
-- | Transform the result of a continuation-passing function.
3132
mapCont :: forall r a. (r -> r) -> Cont r a -> Cont r a
32-
mapCont f = mapContT (Identity <<< f <<< runIdentity)
33+
mapCont f = mapContT (Identity <<< f <<< unwrap)
3334

3435
-- | Transform the continuation passed into the continuation-passing function.
3536
withCont :: forall a b r. ((b -> r) -> (a -> r)) -> Cont r a -> Cont r b
36-
withCont f = withContT (compose Identity <<< f <<< compose runIdentity)
37+
withCont f = withContT (compose Identity <<< f <<< compose unwrap)

src/Control/Monad/Error/Class.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Data.Either (Either(..))
2323
-- | - Catch: `catchError (throwError e) f = f e`
2424
-- | - Pure: `catchError (pure a) f = pure a`
2525
-- |
26-
class Monad m <= MonadError e m where
26+
class Monad m <= MonadError e m | m -> e where
2727
throwError :: forall a. e -> m a
2828
catchError :: forall a. m a -> (e -> m a) -> m a
2929

src/Control/Monad/Except.purs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import Control.Monad.Error.Class (class MonadError, catchError, catchJust, throw
1414
import Control.Monad.Except.Trans (class MonadTrans, ExceptT(..), except, lift, mapExceptT, runExceptT, withExceptT)
1515

1616
import Data.Either (Either)
17-
import Data.Identity (Identity(..), runIdentity)
17+
import Data.Identity (Identity(..))
18+
import Data.Newtype (unwrap)
1819

1920
-- | A parametrizable exception monad; computations are either exceptions or
2021
-- | pure values. If an exception is thrown (see `throwError`), the computation
@@ -35,11 +36,11 @@ type Except e a = ExceptT e Identity a
3536

3637
-- | Run a computation in the `Except` monad. The inverse of `except`.
3738
runExcept :: forall e a. Except e a -> Either e a
38-
runExcept = runIdentity <<< runExceptT
39+
runExcept = unwrap <<< runExceptT
3940

4041
-- | Transform the unwrapped computation using the given function.
4142
mapExcept :: forall e e' a b. (Either e a -> Either e' b) -> Except e a -> Except e' b
42-
mapExcept f = mapExceptT (Identity <<< f <<< runIdentity)
43+
mapExcept f = mapExceptT (Identity <<< f <<< unwrap)
4344

4445
-- | Transform any exceptions thrown by an `Except` computation using the given function.
4546
withExcept :: forall e e' a. (e -> e') -> Except e a -> Except e' a

src/Control/Monad/Except/Trans.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Control.Monad.Cont.Class (class MonadCont, callCC)
1414
import Control.Monad.Eff.Class (class MonadEff, liftEff)
1515
import Control.Monad.Error.Class (class MonadError, throwError, catchError)
1616
import Control.Monad.Reader.Class (class MonadReader, local, ask)
17-
import Control.Monad.Rec.Class (class MonadRec, tailRecM)
17+
import Control.Monad.Rec.Class (class MonadRec, tailRecM, Step(..))
1818
import Control.Monad.RWS.Class (class MonadRWS)
1919
import Control.Monad.State.Class (class MonadState, state)
2020
import Control.Monad.Trans (class MonadTrans, lift)
@@ -75,9 +75,9 @@ instance monadRecExceptT :: MonadRec m => MonadRec (ExceptT e m) where
7575
case f a of ExceptT m ->
7676
m >>= \m' ->
7777
pure case m' of
78-
Left e -> Right (Left e)
79-
Right (Left a1) -> Left a1
80-
Right (Right b) -> Right (Right b)
78+
Left e -> Done (Left e)
79+
Right (Loop a1) -> Loop a1
80+
Right (Done b) -> Done (Right b)
8181

8282
instance altExceptT :: (Semigroup e, Monad m) => Alt (ExceptT e m) where
8383
alt (ExceptT m) (ExceptT n) = ExceptT do

src/Control/Monad/Maybe/Trans.purs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Control.Monad.Cont.Class (class MonadCont, callCC)
1313
import Control.Monad.Eff.Class (class MonadEff, liftEff)
1414
import Control.Monad.Error.Class (class MonadError, catchError, throwError)
1515
import Control.Monad.Reader.Class (class MonadReader, local, ask)
16-
import Control.Monad.Rec.Class (class MonadRec, tailRecM)
16+
import Control.Monad.Rec.Class (class MonadRec, tailRecM, Step(..))
1717
import Control.Monad.RWS.Class (class MonadRWS)
1818
import Control.Monad.State.Class (class MonadState, state)
1919
import Control.Monad.Trans (class MonadTrans, lift)
@@ -22,7 +22,6 @@ import Control.MonadPlus (class MonadPlus)
2222
import Control.MonadZero (class MonadZero)
2323
import Control.Plus (class Plus)
2424

25-
import Data.Either (Either(..))
2625
import Data.Maybe (Maybe(..))
2726
import Data.Tuple (Tuple(..))
2827

@@ -81,12 +80,12 @@ instance monadZeroMaybeT :: Monad m => MonadZero (MaybeT m)
8180
instance monadRecMaybeT :: MonadRec m => MonadRec (MaybeT m) where
8281
tailRecM f =
8382
MaybeT <<< tailRecM \a ->
84-
case f a of
85-
MaybeT m -> m >>= \m' ->
83+
case f a of MaybeT m ->
84+
m >>= \m' ->
8685
pure case m' of
87-
Nothing -> Right Nothing
88-
Just (Left a1) -> Left a1
89-
Just (Right b) -> Right (Just b)
86+
Nothing -> Done Nothing
87+
Just (Loop a1) -> Loop a1
88+
Just (Done b) -> Done (Just b)
9089

9190
instance monadEffMaybe :: MonadEff eff m => MonadEff eff (MaybeT m) where
9291
liftEff = lift <<< liftEff

src/Control/Monad/RWS.purs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import Prelude
1717
import Control.Monad.RWS.Class (class MonadRWS, class MonadReader, class MonadState, class MonadTrans, class MonadWriter, ask, censor, get, gets, lift, listen, listens, local, modify, pass, put, reader, state, tell, writer)
1818
import Control.Monad.RWS.Trans (class MonadTrans, RWSResult(..), RWST(..), evalRWST, execRWST, lift, mapRWST, runRWST, withRWST)
1919

20-
import Data.Identity (Identity(..), runIdentity)
20+
import Data.Identity (Identity(..))
21+
import Data.Newtype (unwrap)
2122
import Data.Tuple (Tuple)
2223

2324
-- | The `RWS` monad is a synonym for the `RWST` monad transformer, applied
@@ -35,15 +36,15 @@ runRWS m r s = case m of RWST f -> case f r s of Identity x -> x
3536

3637
-- | Run a computation in the `RWS` monad, discarding the final state
3738
evalRWS :: forall r w s a. RWS r w s a -> r -> s -> Tuple a w
38-
evalRWS m r s = runIdentity $ evalRWST m r s
39+
evalRWS m r s = unwrap $ evalRWST m r s
3940

4041
-- | Run a computation in the `RWS` monad, discarding the result
4142
execRWS :: forall r w s a. RWS r w s a -> r -> s -> Tuple s w
42-
execRWS m r s = runIdentity $ execRWST m r s
43+
execRWS m r s = unwrap $ execRWST m r s
4344

4445
-- | Change the types of the result and accumulator in a `RWS` action
4546
mapRWS :: forall r w1 w2 s a1 a2. (RWSResult s a1 w1 -> RWSResult s a2 w2) -> RWS r w1 s a1 -> RWS r w2 s a2
46-
mapRWS f = mapRWST (runIdentity >>> f >>> Identity)
47+
mapRWS f = mapRWST (unwrap >>> f >>> Identity)
4748

4849
-- | Change the type of the context in a `RWS` action
4950
withRWS :: forall r1 r2 w s a. (r2 -> s -> Tuple r1 s) -> RWS r1 w s a -> RWS r2 w s a

src/Control/Monad/RWS/Class.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ import Control.Monad.Writer.Class (class MonadWriter, censor, listen, listens, p
1919
-- |
2020
-- | An implementation is provided for `RWST`, and for other monad transformers
2121
-- | defined in this library.
22-
class (MonadReader r m, MonadWriter w m, MonadState s m) <= MonadRWS r w s m
22+
class (MonadReader r m, MonadWriter w m, MonadState s m) <= MonadRWS r w s m | m -> r w s

src/Control/Monad/RWS/Trans.purs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ import Prelude
1212
import Control.Monad.Eff.Class (class MonadEff, liftEff)
1313
import Control.Monad.Error.Class (class MonadError, throwError, catchError)
1414
import Control.Monad.Reader.Class (class MonadReader)
15-
import Control.Monad.Rec.Class (class MonadRec, tailRecM)
15+
import Control.Monad.Rec.Class (class MonadRec, tailRecM, Step(..))
1616
import Control.Monad.RWS.Class (class MonadRWS)
1717
import Control.Monad.State.Class (class MonadState)
1818
import Control.Monad.Trans (class MonadTrans, lift)
1919
import Control.Monad.Writer.Class (class MonadWriter)
2020

21-
import Data.Either (Either(..))
2221
import Data.Monoid (class Monoid, mempty)
2322
import Data.Tuple (Tuple(..), uncurry)
2423

@@ -111,5 +110,5 @@ instance monadRecRWST :: (MonadRec m, Monoid w) => MonadRec (RWST r w s m) where
111110
RWST m -> do
112111
RWSResult state' result' writer' <- m r state
113112
pure case result' of
114-
Left a -> Left (RWSResult state' a (writer <> writer'))
115-
Right b -> Right (RWSResult state' b (writer <> writer'))
113+
Loop a -> Loop (RWSResult state' a (writer <> writer'))
114+
Done b -> Done (RWSResult state' b (writer <> writer'))

src/Control/Monad/Reader.purs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ import Prelude
1414
import Control.Monad.Reader.Class (class MonadReader, ask, local, reader)
1515
import Control.Monad.Reader.Trans (class MonadTrans, ReaderT(..), lift, mapReaderT, runReaderT, withReaderT)
1616

17-
import Data.Identity (Identity(..), runIdentity)
17+
import Data.Identity (Identity(..))
18+
import Data.Newtype (unwrap)
1819

1920
-- | The `Reader` monad is a synonym for the `ReaderT` monad transformer, applied
2021
-- | to the `Identity` monad.
2122
type Reader r = ReaderT r Identity
2223

2324
-- | Run a computation in the `Reader` monad.
2425
runReader :: forall r a. Reader r a -> r -> a
25-
runReader (ReaderT m) = runIdentity <<< m
26+
runReader (ReaderT m) = unwrap <<< m
2627

2728
-- | Change the type of the context in a `Reader` monad action.
2829
withReader :: forall r1 r2 a. (r2 -> r1) -> Reader r1 a -> Reader r2 a
2930
withReader = withReaderT
3031

3132
-- | Change the type of the result in a `Reader` monad action.
3233
mapReader :: forall r a b. (a -> b) -> Reader r a -> Reader r b
33-
mapReader f = mapReaderT $ Identity <<< f <<< runIdentity
34+
mapReader f = mapReaderT $ Identity <<< f <<< unwrap

src/Control/Monad/Reader/Class.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Prelude
1919
-- | - `local f ask = f <$> ask`
2020
-- | - `local _ (pure a) = pure a`
2121
-- | - `local f (do { a <- x ; y }) = do { a <- local f x ; local f y }`
22-
class Monad m <= MonadReader r m where
22+
class Monad m <= MonadReader r m | m -> r where
2323
ask :: m r
2424
local :: forall a. (r -> r) -> m a -> m a
2525

src/Control/Monad/Reader/Trans.purs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import Control.MonadZero (class MonadZero)
2323
import Control.Plus (class Plus, empty)
2424

2525
import Data.Distributive (class Distributive, distribute, collect)
26-
import Data.Either (Either(..), either)
2726

2827
-- | The reader monad transformer.
2928
-- |
@@ -106,4 +105,4 @@ instance distributiveReaderT :: Distributive g => Distributive (ReaderT e g) whe
106105
instance monadRecReaderT :: MonadRec m => MonadRec (ReaderT r m) where
107106
tailRecM k a = ReaderT \r -> tailRecM (k' r) a
108107
where
109-
k' r a = case k a of ReaderT f -> pure <<< either Left Right =<< f r
108+
k' r a = case k a of ReaderT f -> pure =<< f r

src/Control/Monad/State.purs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import Prelude
1616
import Control.Monad.State.Class (class MonadState, get, gets, modify, put, state)
1717
import Control.Monad.State.Trans (class MonadTrans, StateT(..), evalStateT, execStateT, lift, mapStateT, runStateT, withStateT)
1818

19-
import Data.Identity (Identity(..), runIdentity)
19+
import Data.Identity (Identity(..))
20+
import Data.Newtype (unwrap)
2021
import Data.Tuple (Tuple(Tuple))
2122

2223
-- | The `State` monad is a synonym for the `StateT` monad transformer, applied
@@ -25,7 +26,7 @@ type State s = StateT s Identity
2526

2627
-- | Run a computation in the `State` monad
2728
runState :: forall s a. State s a -> s -> Tuple a s
28-
runState (StateT s) = runIdentity <<< s
29+
runState (StateT s) = unwrap <<< s
2930

3031
-- | Run a computation in the `State` monad, discarding the final state
3132
evalState :: forall s a. State s a -> s -> a
@@ -37,7 +38,7 @@ execState (StateT m) s = case m s of Identity (Tuple _ s) -> s
3738

3839
-- | Change the type of the result in a `State` action
3940
mapState :: forall s a b. (Tuple a s -> Tuple b s) -> State s a -> State s b
40-
mapState f = mapStateT (Identity <<< f <<< runIdentity)
41+
mapState f = mapStateT (Identity <<< f <<< unwrap)
4142

4243
-- | Modify the state in a `State` action
4344
withState :: forall s a. (s -> s) -> State s a -> State s a

src/Control/Monad/State/Class.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Data.Tuple (Tuple(..))
2121
-- | - `do { put x ; get } = put x $> x`
2222
-- | - `do { s <- get ; put s } = pure unit`
2323
-- |
24-
class Monad m <= MonadState s m where
24+
class Monad m <= MonadState s m | m -> s where
2525
state :: forall a. (s -> (Tuple a s)) -> m a
2626

2727
-- | Get the current state.

0 commit comments

Comments
 (0)