Skip to content

Commit

Permalink
Merge pull request #81 from clayrat/master
Browse files Browse the repository at this point in the history
Fix name shadowing
  • Loading branch information
garyb authored Nov 9, 2016
2 parents ad6f912 + 37fbd2c commit 93199ec
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Control/Comonad/Env/Class.purs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ instance comonadAskEnvT :: Comonad w => ComonadAsk e (EnvT e w) where

instance comonadEnvEnvT :: Comonad w => ComonadEnv e (EnvT e w) where
local f (EnvT x) = EnvT case x of
Tuple x y -> Tuple (f x) y
Tuple y z -> Tuple (f y) z
2 changes: 1 addition & 1 deletion src/Control/Comonad/Traced/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ instance functorTracedT :: Functor w => Functor (TracedT t w) where
map f (TracedT w) = TracedT ((\g t -> f $ g t) <$> w)

instance extendTracedT :: (Extend w, Semigroup t) => Extend (TracedT t w) where
extend f (TracedT w) = TracedT ((\w t -> f $ TracedT ((\h t' -> h $ t <> t') <$> w)) <<= w)
extend f (TracedT w) = TracedT ((\w' t -> f $ TracedT ((\h t' -> h $ t <> t') <$> w')) <<= w)

instance comonadTracedT :: (Comonad w, Monoid t) => Comonad (TracedT t w) where
extract (TracedT w) = extract w mempty
Expand Down
2 changes: 1 addition & 1 deletion src/Control/Monad/Except/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ withExceptT :: forall e e' m a. Functor m => (e -> e') -> ExceptT e m a -> Excep
withExceptT f (ExceptT t) = ExceptT $ map (mapLeft f) t
where
mapLeft _ (Right x) = Right x
mapLeft f (Left x) = Left (f x)
mapLeft f' (Left x) = Left (f' x)

-- | Transform the unwrapped computation using the given function.
mapExceptT :: forall e e' m n a b. (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b
Expand Down
8 changes: 4 additions & 4 deletions src/Control/Monad/List/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ wrapLazy v = ListT $ pure (Skip v)
unfold :: forall f a z. Monad f => (z -> f (Maybe (Tuple z a))) -> z -> ListT f a
unfold f z = ListT $ g <$> f z
where
g (Just (Tuple z a)) = Yield a (defer \_ -> unfold f z)
g (Just (Tuple z' a)) = Yield a (defer \_ -> unfold f z')
g Nothing = Done

-- | Generate an infinite list by iterating a function.
iterate :: forall f a. Monad f => (a -> a) -> a -> ListT f a
iterate f a = unfold g a
where
g a = pure $ Just (Tuple (f a) a)
g x = pure $ Just (Tuple (f x) x)

-- | Generate an infinite list by repeating a value.
repeat :: forall f a. Monad f => a -> ListT f a
Expand Down Expand Up @@ -255,7 +255,7 @@ instance functorListT :: Functor f => Functor (ListT f) where
instance unfoldableListT :: Monad f => Unfoldable (ListT f) where
unfoldr f b = go (f b)
where go Nothing = nil
go (Just (Tuple a b)) = cons (pure a) (defer \_ -> (go (f b)))
go (Just (Tuple x y)) = cons (pure x) (defer \_ -> (go (f y)))

instance applyListT :: Monad f => Apply (ListT f) where
apply = ap
Expand All @@ -267,7 +267,7 @@ instance bindListT :: Monad f => Bind (ListT f) where
bind fa f = stepMap g fa where
g (Yield a s) = Skip (h <$> s)
where
h s = f a <> (s >>= f)
h s' = f a <> (s' >>= f)
g (Skip s) = Skip ((_ >>= f) <$> s)
g Done = Done

Expand Down
4 changes: 2 additions & 2 deletions src/Control/Monad/RWS/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ instance monadRecRWST :: (MonadRec m, Monoid w) => MonadRec (RWST r w s m) where
RWST m -> do
RWSResult state' result' writer' <- m r state
pure case result' of
Loop a -> Loop (RWSResult state' a (writer <> writer'))
Done b -> Done (RWSResult state' b (writer <> writer'))
Loop x -> Loop (RWSResult state' x (writer <> writer'))
Done y -> Done (RWSResult state' y (writer <> writer'))
4 changes: 2 additions & 2 deletions src/Control/Monad/Reader/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ instance monadEffReader :: MonadEff eff m => MonadEff eff (ReaderT r m) where

instance monadContReaderT :: MonadCont m => MonadCont (ReaderT r m) where
callCC f = ReaderT \r -> callCC \c ->
case f (ReaderT <<< const <<< c) of ReaderT f -> f r
case f (ReaderT <<< const <<< c) of ReaderT f' -> f' r

instance monadErrorReaderT :: MonadError e m => MonadError e (ReaderT r m) where
throwError = lift <<< throwError
Expand Down Expand Up @@ -112,4 +112,4 @@ instance distributiveReaderT :: Distributive g => Distributive (ReaderT e g) whe
instance monadRecReaderT :: MonadRec m => MonadRec (ReaderT r m) where
tailRecM k a = ReaderT \r -> tailRecM (k' r) a
where
k' r a = case k a of ReaderT f -> pure =<< f r
k' r a' = case k a' of ReaderT f -> pure =<< f r
2 changes: 1 addition & 1 deletion src/Control/Monad/State.purs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ evalState (StateT m) s = case m s of Identity (Tuple a _) -> a

-- | Run a computation in the `State` monad, discarding the result
execState :: forall s a. State s a -> s -> s
execState (StateT m) s = case m s of Identity (Tuple _ s) -> s
execState (StateT m) s = case m s of Identity (Tuple _ s') -> s'

-- | Change the type of the result in a `State` action
mapState :: forall s a b. (Tuple a s -> Tuple b s) -> State s a -> State s b
Expand Down
10 changes: 5 additions & 5 deletions src/Control/Monad/State/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ instance monadStateT :: Monad m => Monad (StateT s m)
instance monadRecStateT :: MonadRec m => MonadRec (StateT s m) where
tailRecM f a = StateT \s -> tailRecM f' (Tuple a s)
where
f' (Tuple a s) =
case f a of StateT st ->
f' (Tuple a' s) =
case f a' of StateT st ->
st s >>= \(Tuple m s1) ->
pure case m of
Loop a -> Loop (Tuple a s1)
Done b -> Done (Tuple b s1)
Loop x -> Loop (Tuple x s1)
Done y -> Done (Tuple y s1)

instance monadZeroStateT :: MonadZero m => MonadZero (StateT s m)

Expand All @@ -106,7 +106,7 @@ instance monadEffState :: MonadEff eff m => MonadEff eff (StateT s m) where

instance monadContStateT :: MonadCont m => MonadCont (StateT s m) where
callCC f = StateT \s -> callCC \c ->
case f (\a -> StateT \s' -> c (Tuple a s')) of StateT f -> f s
case f (\a -> StateT \s' -> c (Tuple a s')) of StateT f' -> f' s

instance monadErrorStateT :: MonadError e m => MonadError e (StateT s m) where
throwError e = lift (throwError e)
Expand Down
8 changes: 4 additions & 4 deletions src/Control/Monad/Writer/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ instance monadWriterT :: (Monoid w, Monad m) => Monad (WriterT w m)
instance monadRecWriterT :: (Monoid w, MonadRec m) => MonadRec (WriterT w m) where
tailRecM f a = WriterT $ tailRecM f' (Tuple a mempty)
where
f' (Tuple a w) =
case f a of WriterT wt ->
f' (Tuple a' w) =
case f a' of WriterT wt ->
wt >>= \(Tuple m w1) ->
pure case m of
Loop a -> Loop (Tuple a (w <> w1))
Done b -> Done (Tuple b (w <> w1))
Loop x -> Loop (Tuple x (w <> w1))
Done y -> Done (Tuple y (w <> w1))

instance monadZeroWriterT :: (Monoid w, MonadZero m) => MonadZero (WriterT w m)

Expand Down

0 comments on commit 93199ec

Please sign in to comment.