Skip to content

Commit

Permalink
Add and document a default impl of gtraverse
Browse files Browse the repository at this point in the history
  • Loading branch information
UnkindPartition committed Mar 14, 2013
1 parent 511f380 commit 10b7ddb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Data/Generics/Traversable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ class GTraversable (c :: * -> Constraint) a where
--
-- Other subterms are lifted using 'pure', and the whole structure is
-- folded back using '<*>'.
--
-- 'gtraverse' has a default implementation @const pure@, which works for
-- types without interesting subterms (in particular, atomic types).
gtraverse
:: (Applicative f, ?c :: p c)
=> (forall d . (GTraversable c d, c d, ?c :: p c) => d -> f d)
-> a -> f a
gtraverse = const pure

-- | Generic map over the immediate subterms
gmap
Expand Down

0 comments on commit 10b7ddb

Please sign in to comment.