Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings revealed by PureScript v0.14.1 #49

Merged
merged 3 commits into from
May 6, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Data/Machine/Mealy.purs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module Data.Machine.Mealy
, fromArray
, msplit
, interleave
, once
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question, where in the changelog should this change fall under?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. In one way, it's fixing a bug. In another, it's a new feature because it wasn't previously usable. I think it should at least go in New Features.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add two changes — a bug fix for removing the warnings and a new feature for exporting a previously hidden function, both linking to this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, will do that

, when
, ifte
, wrapEffect
Expand Down Expand Up @@ -154,7 +155,7 @@ take n m = if n <= 0 then halt
drop :: forall f i o. Monad f => Int -> MealyT f i o -> MealyT f i o
drop n m = if n <= 0 then m
else mealy $ \i -> let f Halt = pure Halt
f (Emit o m') = stepMealy i (drop (n - 1) m')
f (Emit _ m') = stepMealy i (drop (n - 1) m')
in stepMealy i m >>= f

-- | Loop a machine forever.
Expand Down Expand Up @@ -195,7 +196,7 @@ collect = scanl (flip Cons) Nil

-- | Creates a machine which emits a single value before halting.
singleton :: forall f i o. Applicative f => o -> MealyT f i o
singleton o = pureMealy $ \i -> Emit o halt
singleton o = pureMealy $ \_ -> Emit o halt

-- | Creates a machine which either emits a single value before halting
-- | (for `Just`), or just halts (in the case of `Nothing`).
Expand Down Expand Up @@ -270,7 +271,7 @@ instance applyMealy :: Apply f => Apply (MealyT f i) where
ap (Emit f' g) (Emit x' y) = Emit (f' x') (g <*> y)

instance applicativeMealy :: Applicative f => Applicative (MealyT f i) where
pure t = pureMealy $ \s -> Emit t halt
pure t = pureMealy $ \_ -> Emit t halt

instance profunctorMealy :: Functor f => Profunctor (MealyT f) where
dimap l r = remap where
Expand Down