deepcontrol-0.3.3.0: Provide more deeper level style of programming than the usual Control.xxx modules express

CopyrightConor McBride and Ross Paterson 2005, (C) 2015 KONISHI Yohsuke
LicenseBSD-style (see the LICENSE file in the distribution)
Maintainerocean0yohsuke@gmail.com
Stabilityexperimental
Portability---
Safe HaskellSafe
LanguageHaskell2010

DeepControl.Commutative

Contents

Description

This module is made of Traversable, distilling most function names polluted with action kind of concepts into crystalized(static) ones. Another reason I put this module is for the case if GHC would parse ((->) r) as a data constructor someday.

Synopsis

Level-1

The Commutative class

class Applicative c => Commutative c where Source

Methods

commute :: Applicative f => c (f a) -> f (c a) Source

This method is equivalent for sequenceA just except the name. The only difference is the name "commute", that is to say from which no action kind of concepts smell.

Utility functions

cmap :: (Applicative f, Commutative c) => (a -> f b) -> c a -> f (c b) Source

Do fmap f then commute, equivalent for traverse.

cfor :: (Applicative f, Commutative c) => c a -> (a -> f b) -> f (c b) Source

The auguments-flipped function for cmap, equivalent for for.

General definitions for superclass methods

fmapDefault :: Commutative t => (a -> b) -> t a -> t b Source

This function may be used as a value for fmap in a Functor instance, provided that commute is defined. (Using fmapDefault with a Commutative instance will result in infinite recursion.)

foldMapDefault :: (Commutative t, Monoid m) => (a -> m) -> t a -> m Source

This function may be used as a value for foldMap in a Foldable instance.

Level-2

sink2 :: (Commutative m1, Commutative m2, Applicative m3) => m1 (m2 (m3 a)) -> m2 (m3 (m1 a)) Source

float2 :: (Applicative m1, Commutative m2, Commutative m3) => m2 (m3 (m1 a)) -> m1 (m2 (m3 a)) Source

Level-3

sink3 :: (Commutative m1, Commutative m2, Commutative m3, Applicative m4) => m1 (m2 (m3 (m4 a))) -> m2 (m3 (m4 (m1 a))) Source

float3 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4) => m2 (m3 (m4 (m1 a))) -> m1 (m2 (m3 (m4 a))) Source

Level-4

sink4 :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4, Applicative m5) => m1 (m2 (m3 (m4 (m5 a)))) -> m2 (m3 (m4 (m5 (m1 a)))) Source

float4 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5) => m2 (m3 (m4 (m5 (m1 a)))) -> m1 (m2 (m3 (m4 (m5 a)))) Source

Level-5

sink5 :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5, Applicative m6) => m1 (m2 (m3 (m4 (m5 (m6 a))))) -> m2 (m3 (m4 (m5 (m6 (m1 a))))) Source

float5 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5, Commutative m6) => m2 (m3 (m4 (m5 (m6 (m1 a))))) -> m1 (m2 (m3 (m4 (m5 (m6 a))))) Source