Skip to content

Commit 52522e7

Browse files
authored
Merge pull request #8 from simonyangme/ps-0.11
Updates for PureScript 0.11
2 parents b67dd35 + 5222fe4 commit 52522e7

File tree

6 files changed

+26
-22
lines changed

6 files changed

+26
-22
lines changed

bower.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
"output"
1717
],
1818
"dependencies": {
19-
"purescript-monoid": "^2.0.0",
20-
"purescript-transformers": "^2.0.1",
21-
"purescript-tuples": "^3.0.0",
22-
"purescript-lists": "^3.2.0",
23-
"purescript-tailrec": "^2.0.0",
24-
"purescript-mmorph": "felixschl/purescript-mmorph#e3cbc72abe8c3dcafdf1648cb63ddb1fac1dcb7f",
25-
"purescript-prelude": "^2.4.0"
19+
"purescript-monoid": "^3.0.0",
20+
"purescript-transformers": "^3.0.0",
21+
"purescript-tuples": "^4.0.0",
22+
"purescript-lists": "^4.0.0",
23+
"purescript-tailrec": "^3.0.0",
24+
"purescript-mmorph": "^3.0.0",
25+
"purescript-prelude": "^3.0.0"
2626
}
2727
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"devDependencies": {
88
"bower": "^1.7.9",
9-
"pulp": "^10.0.0",
9+
"pulp": "^11.0.0",
1010
"rimraf": "^2.4.1"
1111
}
1212
}

src/Pipes.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ next = go
100100
Pure r -> pure (Left r)
101101

102102
-- | Convert a `F.Foldable` to a `Producer`
103-
each :: forall a f m. (Monad m, Foldable f) => f a -> Producer_ a m Unit
103+
each :: forall a f m. Monad m => Foldable f => f a -> Producer_ a m Unit
104104
each xs = F.foldr (\a p -> yield a *> p) (pure unit) xs
105105

106106
-- | Discards a value

src/Pipes/Internal.purs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Data.Tuple (Tuple(Tuple))
66
import Control.Alt (class Alt, (<|>))
77
import Control.Alternative (class Alternative)
88
import Control.Monad.Eff.Class (class MonadEff, liftEff)
9-
import Control.Monad.Except.Trans (class MonadError, catchError, throwError)
9+
import Control.Monad.Except.Trans (class MonadError, catchError, class MonadThrow, throwError)
1010
import Control.Monad.Trans.Class (class MonadTrans, lift)
1111
import Control.Monad.Reader.Class (class MonadAsk, class MonadReader, local, ask)
1212
import Control.Monad.State.Class (class MonadState, state)
@@ -141,9 +141,10 @@ instance proxyAlternative :: (MonadPlus m) => Alternative (Proxy a' a b' b m)
141141
-- instance proxyMonadPlus :: (MonadPlus m) => MonadPlus (Proxy a' a b' b m)
142142
-- instance proxyMonadZero :: (MonadZero m) => MonadZero (Proxy a' a b' b m)
143143

144-
instance proxyMonadError :: (MonadError e m) => MonadError e (Proxy a' a b' b m) where
144+
instance proxyMonadThrow :: (MonadThrow e m) => MonadThrow e (Proxy a' a b' b m) where
145145
throwError = lift <<< throwError
146146

147+
instance proxyMonadError :: (MonadError e m) => MonadError e (Proxy a' a b' b m) where
147148
catchError (Request a' fa) f = Request a' (\a -> catchError (fa a ) f)
148149
catchError (Respond b fb') f = Respond b (\b' -> catchError (fb' b') f)
149150
catchError (Pure r) f = Pure r

src/Pipes/ListT.purs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Control.Alt (class Alt, alt)
55
import Control.Alternative (class Alternative)
66
import Control.Monad.Eff.Class (class MonadEff, liftEff)
77
import Control.Monad.Except.Trans
8-
(ExceptT, runExceptT, class MonadError, class MonadTrans, lift, catchError, throwError)
8+
(ExceptT, runExceptT, class MonadError, class MonadTrans, lift, catchError, class MonadThrow, throwError)
99
import Control.Monad.Maybe.Trans (MaybeT, runMaybeT)
1010
import Control.Monad.Reader.Class (class MonadAsk, class MonadReader, local, ask)
1111
import Control.Monad.Rec.Class (class MonadRec)
@@ -33,7 +33,7 @@ runListT l = runEffect (enumerate (l *> empty))
3333
runListTRec :: forall a m. (MonadRec m) => ListT m a -> m Unit
3434
runListTRec l = runEffectRec (enumerate (l *> empty))
3535

36-
every :: forall a m t. (Monad m, Enumerable t) => t m a -> Producer_ a m Unit
36+
every :: forall a m t. Monad m => Enumerable t => t m a -> Producer_ a m Unit
3737
every it = discard >\\ enumerate (toListT it)
3838

3939
instance listTFunctor :: (Monad m) => Functor (ListT m) where
@@ -106,8 +106,10 @@ instance listTMonadAsk :: (MonadAsk r m) => MonadAsk r (ListT m) where
106106
instance listTMonadReader :: (MonadReader r m) => MonadReader r (ListT m) where
107107
local f (Select l) = Select (local f l)
108108

109-
instance listTMonadError :: (MonadError e m) => MonadError e (ListT m) where
109+
instance listTMonadThrow :: (MonadThrow e m) => MonadThrow e (ListT m) where
110110
throwError = lift <<< throwError
111+
112+
instance listTMonadError :: (MonadError e m) => MonadError e (ListT m) where
111113
catchError (Select l) f = Select (l `catchError` (enumerate <<< f))
112114

113115
class Enumerable t where

src/Pipes/Prelude.purs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ sequence = mapM id
5858
forward each element of the result.
5959
-}
6060
mapFoldable :: forall a b m t r
61-
. (Monad m, Foldable t)
61+
. Monad m
62+
=> Foldable t
6263
=> (a -> t b)
6364
-> Pipe a b m r
6465
mapFoldable f = for cat (\a -> each (f a))
@@ -117,7 +118,7 @@ drop = loop
117118
where
118119
loop 0 = cat
119120
loop n = do
120-
await
121+
_ <- await
121122
loop (n-1)
122123

123124
{-| dropWhile discards values going downstream until one violates the
@@ -135,7 +136,7 @@ dropWhile predicate = go
135136
cat
136137

137138
-- | Flatten all 'Foldable' elements flowing downstream
138-
concat :: forall a m f r. (Monad m, Foldable f) => Pipe (f a) a m r
139+
concat :: forall a m f r. Monad m => Foldable f => Pipe (f a) a m r
139140
concat = for cat each
140141

141142
-- | Outputs the indices of all elements that satisfied the predicate
@@ -183,7 +184,7 @@ chain f = for cat $ \a -> do
183184
yield a
184185

185186
-- | Convert `Show`able values to `String`s
186-
show :: forall a m r. (Monad m, Show a) => Pipe a String m r
187+
show :: forall a m r. Monad m => Show a => Pipe a String m r
187188
show = map Prelude.show
188189

189190
-- | Evaluate all values flowing downstream to WHNF
@@ -270,11 +271,11 @@ or :: forall m. Monad m => Producer Boolean m Unit -> m Boolean
270271
or = any id
271272

272273
-- | elem returns `True` if p has an element equal to a, `False` otherwise
273-
elem :: forall a m. (Monad m, Eq a) => a -> Producer a m Unit -> m Boolean
274+
elem :: forall a m. Monad m => Eq a => a -> Producer a m Unit -> m Boolean
274275
elem a = any (a == _)
275276

276277
-- | notElem returns `False` if p has an element equal to a, `True` otherwise
277-
notElem :: forall a m. (Monad m, Eq a) => a -> Producer a m Unit -> m Boolean
278+
notElem :: forall a m. Monad m => Eq a => a -> Producer a m Unit -> m Boolean
278279
notElem a = all (a /= _)
279280

280281
-- | Find the first element of a `Producer` that satisfies the predicate
@@ -318,7 +319,7 @@ length :: forall a m. Monad m => Producer a m Unit -> m Int
318319
length = fold (\n _ -> n + 1) 0 id
319320

320321
-- | Find the maximum element of a `Producer`
321-
maximum :: forall a m. (Monad m, Ord a) => Producer a m Unit -> m (Maybe a)
322+
maximum :: forall a m. Monad m => Ord a => Producer a m Unit -> m (Maybe a)
322323
maximum = fold step Nothing id
323324
where
324325
step x a = Just $ case x of
@@ -328,7 +329,7 @@ maximum = fold step Nothing id
328329
| otherwise = y
329330

330331
-- | Find the minimum element of a `Producer`
331-
minimum :: forall a m. (Monad m, Ord a) => Producer a m Unit -> m (Maybe a)
332+
minimum :: forall a m. Monad m => Ord a => Producer a m Unit -> m (Maybe a)
332333
minimum = fold step Nothing id
333334
where
334335
step x a = Just $ case x of

0 commit comments

Comments
 (0)