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

Simplify the Eq/Ord instances for FT #216

Merged
merged 1 commit into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
next [????.??.??]
-----------------
* Simplify the `Eq` and `Ord` instances for `FT` to avoid the use of
overlapping instances.

5.1.8 [2022.05.07]
------------------
* Generalize the `Monad` constraint in the type signatures for
Expand Down
15 changes: 12 additions & 3 deletions src/Control/Monad/Trans/Free/Church.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
Expand Down Expand Up @@ -97,10 +96,20 @@ instance ( Functor f, Monad m, Ord1 f, Ord1 m
compare1 x y = compare1 (fromFT x) (fromFT y)
#endif

instance (Eq1 (FT f m), Eq a) => Eq (FT f m a) where
instance ( Functor f, Monad m, Eq1 f, Eq1 m
# if !(MIN_VERSION_base(4,8,0))
, Functor m
# endif
, Eq a
) => Eq (FT f m a) where
(==) = eq1

instance (Ord1 (FT f m), Ord a) => Ord (FT f m a) where
instance ( Functor f, Monad m, Ord1 f, Ord1 m
# if !(MIN_VERSION_base(4,8,0))
, Functor m
# endif
, Ord a
) => Ord (FT f m a) where
compare = compare1

instance Functor (FT f m) where
Expand Down