Permalink
Browse files

Remove superfluous 'c d' constraints

  • Loading branch information...
1 parent 137eacd commit 381e39720a7438d9a93caf2c4e7e8064e9396578 @feuerbach committed Mar 15, 2013
Showing with 10 additions and 11 deletions.
  1. +9 −9 Data/Generics/Traversable.hs
  2. +1 −2 Data/Generics/Traversable/Core.hs
@@ -54,66 +54,66 @@ import Data.Traversable
-- | Generic map over the immediate subterms
gmap
:: (GTraversable c a, ?c :: p c)
- => (forall d . (GTraversable c d, c d) => d -> d)
+ => (forall d . (GTraversable c d) => d -> d)
-> a -> a
gmap f = runIdentity . gtraverse (Identity . f)
-- | Generic monadic map over the immediate subterms
gmapM
:: (Monad m, GTraversable c a, ?c :: p c)
- => (forall d . (GTraversable c d, c d) => d -> m d)
+ => (forall d . (GTraversable c d) => d -> m d)
-> a -> m a
gmapM f = unwrapMonad . gtraverse (WrapMonad . f)
-- | Generic monoidal fold over the immediate subterms (cf. 'foldMap' from
-- "Data.Foldable")
gfoldMap
:: (Monoid r, GTraversable c a, ?c :: p c)
- => (forall d . (GTraversable c d, c d) => d -> r)
+ => (forall d . (GTraversable c d) => d -> r)
-> a -> r
gfoldMap f = getConstant . gtraverse (Constant . f)
-- | Generic right fold over the immediate subterms
gfoldr
:: (GTraversable c a, ?c :: p c)
- => (forall d . (GTraversable c d, c d) => d -> r -> r)
+ => (forall d . (GTraversable c d) => d -> r -> r)
-> r -> a -> r
gfoldr f z t = appEndo (gfoldMap (Endo . f) t) z
-- | Generic strict left fold over the immediate subterms
gfoldl'
:: (GTraversable c a, ?c :: p c)
- => (forall d . (GTraversable c d, c d) => r -> d -> r)
+ => (forall d . (GTraversable c d) => r -> d -> r)
-> r -> a -> r
gfoldl' f z0 xs = gfoldr f' id xs z0
where f' x k z = k $! f z x
-- | Apply a transformation everywhere in bottom-up manner
everywhere
:: (GTraversable c a, c a, ?c :: p c)
- => (forall d. (GTraversable c d, c d) => d -> d)
+ => (forall d. (GTraversable c d) => d -> d)
-> a -> a
everywhere f = f . gmap (everywhere f)
-- | Apply a transformation everywhere in top-down manner
everywhere'
:: (GTraversable c a, c a, ?c :: p c)
- => (forall d. (GTraversable c d, c d) => d -> d)
+ => (forall d. (GTraversable c d) => d -> d)
-> a -> a
everywhere' f = gmap (everywhere' f) . f
-- | Monadic variation on everywhere
everywhereM
:: (Monad m, GTraversable c a, c a, ?c :: p c)
- => (forall d. (GTraversable c d, c d) => d -> m d)
+ => (forall d. (GTraversable c d) => d -> m d)
-> a -> m a
everywhereM f = f <=< gmapM (everywhereM f)
-- | Strict left fold over all elements, top-down
everything
:: (GTraversable c a, c a, ?c :: p c)
=> (r -> r -> r)
- -> (forall d . (GTraversable c d, c d) => d -> r)
+ -> (forall d . (GTraversable c d) => d -> r)
-> a -> r
everything combine f x =
gfoldl' (\a y -> combine a (everything combine f y)) (f x) x
@@ -17,7 +17,6 @@ class c a => GTraversable (c :: * -> Constraint) a where
-- types without interesting subterms (in particular, atomic types).
gtraverse
:: (Applicative f, ?c :: p c)
- => (forall d . (GTraversable c d, c d) => d -> f d)
+ => (forall d . (GTraversable c d) => d -> f d)
-> a -> f a
gtraverse = const pure
-

0 comments on commit 381e397

Please sign in to comment.