File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -295,7 +295,7 @@ chop (Node v ts : us)
295
295
newtype SetM s a = SetM { runSetM :: STArray s Vertex Bool -> ST s a }
296
296
297
297
instance Monad (SetM s ) where
298
- return x = SetM $ const ( return x)
298
+ return = pure
299
299
{-# INLINE return #-}
300
300
SetM v >>= f = SetM $ \ s -> do { x <- v s; runSetM (f x) s }
301
301
{-# INLINE (>>=) #-}
Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ instance NFData a => NFData (Seq a) where
267
267
rnf (Seq xs) = rnf xs
268
268
269
269
instance Monad Seq where
270
- return = singleton
270
+ return = pure
271
271
xs >>= f = foldl' add empty xs
272
272
where add ys x = ys >< f x
273
273
(>>) = (*>)
@@ -861,12 +861,13 @@ instance Functor (State s) where
861
861
instance Monad (State s ) where
862
862
{-# INLINE return #-}
863
863
{-# INLINE (>>=) #-}
864
- return x = State $ \ s -> (s, x)
864
+ return = pure
865
865
m >>= k = State $ \ s -> case runState m s of
866
866
(s', x) -> runState (k x) s'
867
867
868
868
instance Applicative (State s ) where
869
- pure = return
869
+ {-# INLINE pure #-}
870
+ pure x = State $ \ s -> (s, x)
870
871
(<*>) = ap
871
872
872
873
execState :: State s a -> s -> a
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ instance Applicative Tree where
92
92
Node (f x) (map (f <$> ) txs ++ map (<*> tx) tfs)
93
93
94
94
instance Monad Tree where
95
- return x = Node x []
95
+ return = pure
96
96
Node x ts >>= f = Node x' (ts' ++ map (>>= f) ts)
97
97
where Node x' ts' = f x
98
98
You can’t perform that action at this time.
0 commit comments