deepcontrol-0.5.4.3: A library that provides deep-level programming style and(or) notation on Applicative and Monad

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.Traversable

Contents

Description

 

Synopsis

Utility functions

Level-1

sink :: (Traversable t, Applicative f) => t (f a) -> f (t a) Source

Synonym to sequenceA.

>>> sink $ Just [1]
[Just 1]
>>> sink $ Right (Just 1)
Just (Right 1)
>>> sink [[1,2],[3,4]]
[[1,3],[1,4],[2,3],[2,4]]
>>> sink . sink $ [[1,2],[3,4]]
[[1,1,2,2],[1,1,2,4],[1,1,3,2],[1,1,3,4],[1,4,2,2],[1,4,2,4],[1,4,3,2],[1,4,3,4],[3,1,2,2],[3,1,2,4],[3,1,3,2],[3,1,3,4],[3,4,2,2],[3,4,2,4],[3,4,3,2],[3,4,3,4]]

sinkmap :: (Applicative f, Traversable c) => (a -> f b) -> c a -> f (c b) Source

Alias to traversable.

Level-2

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

Definition: sink2 = (sink|$>) . sink

>>> sink2 $ Just [[1]]
[[Just 1]]
>>> sink2 $ Right (Just [1])
Just [Right 1]

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

Definition: float2 = sink . (sink|$>)

>>> float2 $ [[Just 1]]
Just [[1]]
>>> float2 $ Just [Right 1]
Right (Just [1])

Level-3

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

Definition: sink3 = (sink2|$>) . sink

>>> sink3 $ Just [[[1]]]
[[[Just 1]]]
>>> sink3 $ Right [Just [1]]
[Just [Right 1]]

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

Definition: float3 = sink . (float2|$>)

>>> float3 $ [[[Just 1]]]
Just [[[1]]]
>>> float3 $ [Just [Right 1]]
Right [Just [1]]

Level-4

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

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

Level-5

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

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