HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulesemigroupoids-6.0.2Haskell2010

Data.Semigroup.Traversable

Contents
  1. Defining Traversable1 instances
  2. Default superclass instance helpers
Synopsis
classclass (Foldable1 t, Traversable t) => Traversable1 (t :: Type -> Type) where
#

Methods

Instances30Traversable1, …

Defining Traversable1 instances

Defining Traversable1 instances for types with both Traversable1 and Traversable substructures can be done with traverse1Maybe, (<*.>), and (<.*>).

data Foo a = Foo (Maybe a) (Maybe a) a [a]
  deriving (Functor, Traversable, Foldable)
instance Traversable1 Foo where
  traverse1 f (Foo ma ma' a as) = Foo <$> traverseMaybe ma <*> traverseMaybe ma' <*.> f a <.*> traverseMaybe as
instance Foldable1 Foo where
  foldMap1 = foldMap1Default

Default superclass instance helpers