Stability | unstable |
---|---|
Safe Haskell | Safe |
Language | Haskell2010 |
- Types, EqN?/ShowN?/(Bi)Functor/Foldable1?/Traversable1?
- (Un)conses/snocs for TwoFingerOddA.
- (Un)conses/snocs for TwoFingerOddE.
- (Un)conses/snocs for TwoFingerEvenE.
- (Un)conses/snocs for TwoFingerEvenA.
- Monad and Applicative instances, and related operations
- Construction and deconstruction of TwoFingerOddA.
- Construction of TwoFingerOddE
- Concatenation of TwoFingerOddA.
- Concatenation of TwoFingerEvenE.
- Concatenation of TwoFingerEvenA.
- Monoid actions
This is an internal module and not subject to the PVP. It may receive arbitrary changes at any time and between any two releases. Import from Q4C12.TwoFinger instead, unless you really need the gory details, and, in that case, you must depend on the exact version of this package. (If you do need them, please file a bug so that, hopefully, your use-case can be accomplished through the public interface.)
- (<.*>) :: Apply f => f (a -> b) -> MaybeApply f a -> f b
- (<*.>) :: Apply f => MaybeApply f (a -> b) -> f a -> f b
- traverseDefault :: (Applicative f, Traversable1 t) => (a -> f a') -> t a -> f (t a')
- bitraverseDefault :: (Applicative f, Bitraversable1 t) => (a -> f a') -> (b -> f b') -> t a b -> f (t a' b')
- data TwoFingerOddA e a = TwoFingerOddA (Seq (a, e)) a
- firstOddA :: Functor f => (a -> f a) -> TwoFingerOddA e a -> f (TwoFingerOddA e a)
- lastOddA :: Functor f => (a -> f a) -> TwoFingerOddA e a -> f (TwoFingerOddA e a)
- data TwoFingerOddE e a = TwoFingerOddE e (Seq (a, e))
- data TwoFingerEvenE e a
- = EmptyEvenE
- | TwoFingerEvenE e (Seq (a, e)) a
- data TwoFingerEvenA e a = TwoFingerEvenA (Seq (a, e))
- consOddA :: a -> e -> TwoFingerOddA e a -> TwoFingerOddA e a
- snocOddA :: TwoFingerOddA e a -> e -> a -> TwoFingerOddA e a
- unconsOddA :: TwoFingerOddA e a -> Either a ((a, e), TwoFingerOddA e a)
- unsnocOddA :: TwoFingerOddA e a -> Either a (TwoFingerOddA e a, (e, a))
- halfconsOddA :: e -> TwoFingerOddA e a -> TwoFingerEvenE e a
- halfsnocOddA :: TwoFingerOddA e a -> e -> TwoFingerEvenA e a
- halfunconsOddA :: TwoFingerOddA e a -> (a, TwoFingerEvenE e a)
- halfunsnocOddA :: TwoFingerOddA e a -> (TwoFingerEvenA e a, a)
- consOddE :: e -> a -> TwoFingerOddE e a -> TwoFingerOddE e a
- snocOddE :: TwoFingerOddE e a -> a -> e -> TwoFingerOddE e a
- unconsOddE :: TwoFingerOddE e a -> Either e ((e, a), TwoFingerOddE e a)
- unsnocOddE :: TwoFingerOddE e a -> Either e (TwoFingerOddE e a, (a, e))
- halfconsOddE :: a -> TwoFingerOddE e a -> TwoFingerEvenA e a
- halfsnocOddE :: TwoFingerOddE e a -> a -> TwoFingerEvenE e a
- halfunconsOddE :: TwoFingerOddE e a -> (e, TwoFingerEvenA e a)
- halfunsnocOddE :: TwoFingerOddE e a -> (TwoFingerEvenE e a, e)
- consEvenE :: e -> a -> TwoFingerEvenE e a -> TwoFingerEvenE e a
- snocEvenE :: TwoFingerEvenE e a -> e -> a -> TwoFingerEvenE e a
- unconsEvenE :: TwoFingerEvenE e a -> Maybe ((e, a), TwoFingerEvenE e a)
- unsnocEvenE :: TwoFingerEvenE e a -> Maybe (TwoFingerEvenE e a, (e, a))
- halfconsEvenE :: a -> TwoFingerEvenE e a -> TwoFingerOddA e a
- halfsnocEvenE :: TwoFingerEvenE e a -> e -> TwoFingerOddE e a
- halfunconsEvenE :: TwoFingerEvenE e a -> Maybe (e, TwoFingerOddA e a)
- halfunsnocEvenE :: TwoFingerEvenE e a -> Maybe (TwoFingerOddE e a, a)
- consEvenA :: a -> e -> TwoFingerEvenA e a -> TwoFingerEvenA e a
- snocEvenA :: TwoFingerEvenA e a -> a -> e -> TwoFingerEvenA e a
- unconsEvenA :: TwoFingerEvenA e a -> Maybe ((a, e), TwoFingerEvenA e a)
- unsnocEvenA :: TwoFingerEvenA e a -> Maybe (TwoFingerEvenA e a, (a, e))
- halfconsEvenA :: e -> TwoFingerEvenA e a -> TwoFingerOddE e a
- halfsnocEvenA :: TwoFingerEvenA e a -> a -> TwoFingerOddA e a
- halfunconsEvenA :: TwoFingerEvenA e a -> Maybe (a, TwoFingerOddE e a)
- halfunsnocEvenA :: TwoFingerEvenA e a -> Maybe (TwoFingerOddA e a, e)
- joinOddA :: TwoFingerOddA (TwoFingerOddE e a) (TwoFingerOddA e a) -> TwoFingerOddA e a
- joinOddE :: TwoFingerOddE (TwoFingerOddE e a) (TwoFingerOddA e a) -> TwoFingerOddE e a
- joinEvenA :: TwoFingerEvenA (TwoFingerOddE e a) (TwoFingerOddA e a) -> TwoFingerEvenA e a
- joinEvenE :: TwoFingerEvenE (TwoFingerOddE e a) (TwoFingerOddA e a) -> TwoFingerEvenE e a
- singletonOddA :: a -> TwoFingerOddA e a
- unitOddA :: (Monoid a, Semigroup a) => e -> TwoFingerOddA e a
- onlyOddA :: TwoFingerOddA e a -> Maybe a
- interleavingOddA :: e -> NonEmpty a -> TwoFingerOddA e a
- singletonOddE :: e -> TwoFingerOddE e a
- appendOddA :: Semigroup a => TwoFingerOddA e a -> TwoFingerOddA e a -> TwoFingerOddA e a
- appendEvenE :: TwoFingerEvenE e a -> TwoFingerEvenE e a -> TwoFingerEvenE e a
- appendEvenA :: TwoFingerEvenA e a -> TwoFingerEvenA e a -> TwoFingerEvenA e a
- appendOddAEvenE :: TwoFingerOddA e a -> TwoFingerEvenE e a -> TwoFingerOddA e a
- appendEvenAOddA :: TwoFingerEvenA e a -> TwoFingerOddA e a -> TwoFingerOddA e a
- appendOddAOddE :: TwoFingerOddA e a -> TwoFingerOddE e a -> TwoFingerEvenA e a
- appendOddEOddA :: TwoFingerOddE e a -> TwoFingerOddA e a -> TwoFingerEvenE e a
- appendOddEEvenA :: TwoFingerOddE e a -> TwoFingerEvenA e a -> TwoFingerOddE e a
- appendEvenEOddE :: TwoFingerEvenE e a -> TwoFingerOddE e a -> TwoFingerOddE e a
Documentation
>>>
import Data.List (unfoldr)
>>>
import Data.Tuple (swap)
>>>
import Control.Lens (over, view)
>>>
let hush = either (const Nothing) Just
(<.*>) :: Apply f => f (a -> b) -> MaybeApply f a -> f b infixl 4 Source #
(<*.>) :: Apply f => MaybeApply f (a -> b) -> f a -> f b infixl 4 Source #
traverseDefault :: (Applicative f, Traversable1 t) => (a -> f a') -> t a -> f (t a') Source #
bitraverseDefault :: (Applicative f, Bitraversable1 t) => (a -> f a') -> (b -> f b') -> t a b -> f (t a' b') Source #
Types, EqN?/ShowN?/(Bi)Functor/Foldable1?/Traversable1?
data TwoFingerOddA e a Source #
Isomorphic to a, (e, a)*
TwoFingerOddA (Seq (a, e)) a |
firstOddA :: Functor f => (a -> f a) -> TwoFingerOddA e a -> f (TwoFingerOddA e a) Source #
Access the first a
of a
. \(O(1)\). This
type is TwoFingerOddA
e aLens' (
in disguise.TwoFingerOddA
e a) a
>>>
view firstOddA (consOddA 3 True $ singletonOddA 15)
3
lastOddA :: Functor f => (a -> f a) -> TwoFingerOddA e a -> f (TwoFingerOddA e a) Source #
Access the last a
of a
. \(O(1)\). This type
is TwoFingerOddA
e aLens' (
in disguise.TwoFingerOddA
e a) a
>>>
over lastOddA (+ 5) (consOddA 3 True $ singletonOddA 15)
consOddA 3 True (singletonOddA 20)
data TwoFingerOddE e a Source #
Isomorphic to e, (a, e)*
TwoFingerOddE e (Seq (a, e)) |
Bitraversable TwoFingerOddE Source # | |
Bifoldable TwoFingerOddE Source # | |
Bifunctor TwoFingerOddE Source # | |
Eq2 TwoFingerOddE Source # | |
Show2 TwoFingerOddE Source # | |
Bitraversable1 TwoFingerOddE Source # | |
Bifoldable1 TwoFingerOddE Source # | |
Functor (TwoFingerOddE e) Source # | |
Foldable (TwoFingerOddE e) Source # | |
Traversable (TwoFingerOddE e) Source # | |
Eq e => Eq1 (TwoFingerOddE e) Source # | |
Show e => Show1 (TwoFingerOddE e) Source # | |
(Eq e, Eq a) => Eq (TwoFingerOddE e a) Source # | |
(Show e, Show a) => Show (TwoFingerOddE e a) Source # | |
Generic (TwoFingerOddE e a) Source # | |
(NFData e, NFData a) => NFData (TwoFingerOddE e a) Source # | |
type Rep (TwoFingerOddE e a) Source # | |
data TwoFingerEvenE e a Source #
Isomorphic to (e, a)*
EmptyEvenE | |
TwoFingerEvenE e (Seq (a, e)) a |
Bitraversable TwoFingerEvenE Source # | |
Bifoldable TwoFingerEvenE Source # | |
Bifunctor TwoFingerEvenE Source # | |
Eq2 TwoFingerEvenE Source # | |
Show2 TwoFingerEvenE Source # | |
Functor (TwoFingerEvenE e) Source # | |
Foldable (TwoFingerEvenE e) Source # | |
Traversable (TwoFingerEvenE e) Source # | |
Eq e => Eq1 (TwoFingerEvenE e) Source # | |
Show e => Show1 (TwoFingerEvenE e) Source # | |
Plus (TwoFingerEvenE e) Source # | |
Alt (TwoFingerEvenE e) Source # | |
(Eq e, Eq a) => Eq (TwoFingerEvenE e a) Source # | |
(Show e, Show a) => Show (TwoFingerEvenE e a) Source # | |
Generic (TwoFingerEvenE e a) Source # | |
Semigroup (TwoFingerEvenE e a) Source # | |
Monoid (TwoFingerEvenE e a) Source # | |
(NFData e, NFData a) => NFData (TwoFingerEvenE e a) Source # | |
type Rep (TwoFingerEvenE e a) Source # | |
data TwoFingerEvenA e a Source #
Isomorphic to (a, e)*
TwoFingerEvenA (Seq (a, e)) |
Bitraversable TwoFingerEvenA Source # | |
Bifoldable TwoFingerEvenA Source # | |
Bifunctor TwoFingerEvenA Source # | |
Eq2 TwoFingerEvenA Source # | |
Show2 TwoFingerEvenA Source # | |
Functor (TwoFingerEvenA e) Source # | |
Foldable (TwoFingerEvenA e) Source # | |
Traversable (TwoFingerEvenA e) Source # | |
Eq e => Eq1 (TwoFingerEvenA e) Source # | |
Show e => Show1 (TwoFingerEvenA e) Source # | |
Plus (TwoFingerEvenA e) Source # | |
Alt (TwoFingerEvenA e) Source # | |
(Eq e, Eq a) => Eq (TwoFingerEvenA e a) Source # | |
(Show e, Show a) => Show (TwoFingerEvenA e a) Source # | |
Generic (TwoFingerEvenA e a) Source # | |
Semigroup (TwoFingerEvenA e a) Source # | |
Monoid (TwoFingerEvenA e a) Source # | |
(NFData e, NFData a) => NFData (TwoFingerEvenA e a) Source # | |
type Rep (TwoFingerEvenA e a) Source # | |
(Un)conses/snocs for TwoFingerOddA.
consOddA :: a -> e -> TwoFingerOddA e a -> TwoFingerOddA e a Source #
snocOddA :: TwoFingerOddA e a -> e -> a -> TwoFingerOddA e a Source #
unconsOddA :: TwoFingerOddA e a -> Either a ((a, e), TwoFingerOddA e a) Source #
unsnocOddA :: TwoFingerOddA e a -> Either a (TwoFingerOddA e a, (e, a)) Source #
halfconsOddA :: e -> TwoFingerOddA e a -> TwoFingerEvenE e a Source #
\(O(1)\) worst case. Inverse: halfunconsEvenE
halfsnocOddA :: TwoFingerOddA e a -> e -> TwoFingerEvenA e a Source #
\(O(\log n)\) worst case. Inverse: halfunsnocEvenA
halfunconsOddA :: TwoFingerOddA e a -> (a, TwoFingerEvenE e a) Source #
\(O(\log n)\) worst case. Inverse: halfconsEvenE
halfunsnocOddA :: TwoFingerOddA e a -> (TwoFingerEvenA e a, a) Source #
\(O(1)\) worst case. Inverse: halfsnocEvenA
(Un)conses/snocs for TwoFingerOddE.
consOddE :: e -> a -> TwoFingerOddE e a -> TwoFingerOddE e a Source #
snocOddE :: TwoFingerOddE e a -> a -> e -> TwoFingerOddE e a Source #
unconsOddE :: TwoFingerOddE e a -> Either e ((e, a), TwoFingerOddE e a) Source #
unsnocOddE :: TwoFingerOddE e a -> Either e (TwoFingerOddE e a, (a, e)) Source #
halfconsOddE :: a -> TwoFingerOddE e a -> TwoFingerEvenA e a Source #
\(O(\log n)\) worst case. Inverse: halfunconsEvenA
halfsnocOddE :: TwoFingerOddE e a -> a -> TwoFingerEvenE e a Source #
\(O(1)\) worst case. Inverse: halfunsnocEvenE
halfunconsOddE :: TwoFingerOddE e a -> (e, TwoFingerEvenA e a) Source #
\(O(1)\) worst case. Inverse: halfconsEvenA
halfunsnocOddE :: TwoFingerOddE e a -> (TwoFingerEvenE e a, e) Source #
\(O(\log n)\) worst case. Inverse: halfsnocEvenE
(Un)conses/snocs for TwoFingerEvenE.
consEvenE :: e -> a -> TwoFingerEvenE e a -> TwoFingerEvenE e a Source #
snocEvenE :: TwoFingerEvenE e a -> e -> a -> TwoFingerEvenE e a Source #
unconsEvenE :: TwoFingerEvenE e a -> Maybe ((e, a), TwoFingerEvenE e a) Source #
unsnocEvenE :: TwoFingerEvenE e a -> Maybe (TwoFingerEvenE e a, (e, a)) Source #
halfconsEvenE :: a -> TwoFingerEvenE e a -> TwoFingerOddA e a Source #
\(O(\log n)\) worst case. Inverse: halfunconsOddA
halfsnocEvenE :: TwoFingerEvenE e a -> e -> TwoFingerOddE e a Source #
\(O(\log n)\) worst case. Inverse: halfunsnocOddE
.
halfunconsEvenE :: TwoFingerEvenE e a -> Maybe (e, TwoFingerOddA e a) Source #
\(O(1)\) worst case. Inverse: halfconsOddA
.
halfunsnocEvenE :: TwoFingerEvenE e a -> Maybe (TwoFingerOddE e a, a) Source #
\(O(1)\) worst case. Inverse: halfsnocOddE
.
(Un)conses/snocs for TwoFingerEvenA.
consEvenA :: a -> e -> TwoFingerEvenA e a -> TwoFingerEvenA e a Source #
snocEvenA :: TwoFingerEvenA e a -> a -> e -> TwoFingerEvenA e a Source #
unconsEvenA :: TwoFingerEvenA e a -> Maybe ((a, e), TwoFingerEvenA e a) Source #
unsnocEvenA :: TwoFingerEvenA e a -> Maybe (TwoFingerEvenA e a, (a, e)) Source #
halfconsEvenA :: e -> TwoFingerEvenA e a -> TwoFingerOddE e a Source #
\(O(1)\) worst case. Inverse: halfunconsOddE
.
halfsnocEvenA :: TwoFingerEvenA e a -> a -> TwoFingerOddA e a Source #
\(O(1)\) worst case. Inverse: halfunsnocOddA
.
halfunconsEvenA :: TwoFingerEvenA e a -> Maybe (a, TwoFingerOddE e a) Source #
\(O(\log n)\) worst case. Inverse: halfconsOddE
.
halfunsnocEvenA :: TwoFingerEvenA e a -> Maybe (TwoFingerOddA e a, e) Source #
\(O(\log n)\) worst case. Inverse: halfsnocOddA
.
Monad and Applicative instances, and related operations
joinOddA :: TwoFingerOddA (TwoFingerOddE e a) (TwoFingerOddA e a) -> TwoFingerOddA e a Source #
joinOddE :: TwoFingerOddE (TwoFingerOddE e a) (TwoFingerOddA e a) -> TwoFingerOddE e a Source #
joinEvenA :: TwoFingerEvenA (TwoFingerOddE e a) (TwoFingerOddA e a) -> TwoFingerEvenA e a Source #
joinEvenE :: TwoFingerEvenE (TwoFingerOddE e a) (TwoFingerOddA e a) -> TwoFingerEvenE e a Source #
Construction and deconstruction of TwoFingerOddA.
singletonOddA :: a -> TwoFingerOddA e a Source #
unitOddA :: (Monoid a, Semigroup a) => e -> TwoFingerOddA e a Source #
Surrounds the argument with mempty
.
>>>
unitOddA 3 :: TwoFingerOddA Int String
consOddA "" 3 (singletonOddA "")
onlyOddA :: TwoFingerOddA e a -> Maybe a Source #
>>>
onlyOddA (singletonOddA "Hello!")
Just "Hello!">>>
onlyOddA (consOddA True 3 $ singletonOddA False)
Nothing
interleavingOddA :: e -> NonEmpty a -> TwoFingerOddA e a Source #
>>>
interleavingOddA "sep" (3 :| [4, 5])
consOddA 3 "sep" (consOddA 4 "sep" (singletonOddA 5))
Construction of TwoFingerOddE
singletonOddE :: e -> TwoFingerOddE e a Source #
Concatenation of TwoFingerOddA.
appendOddA :: Semigroup a => TwoFingerOddA e a -> TwoFingerOddA e a -> TwoFingerOddA e a Source #
Concatenation of TwoFingerEvenE.
appendEvenE :: TwoFingerEvenE e a -> TwoFingerEvenE e a -> TwoFingerEvenE e a Source #
Concatenation of TwoFingerEvenA.
appendEvenA :: TwoFingerEvenA e a -> TwoFingerEvenA e a -> TwoFingerEvenA e a Source #
Monoid actions
appendOddAEvenE :: TwoFingerOddA e a -> TwoFingerEvenE e a -> TwoFingerOddA e a Source #
appendEvenAOddA :: TwoFingerEvenA e a -> TwoFingerOddA e a -> TwoFingerOddA e a Source #
appendOddAOddE :: TwoFingerOddA e a -> TwoFingerOddE e a -> TwoFingerEvenA e a Source #
appendOddEOddA :: TwoFingerOddE e a -> TwoFingerOddA e a -> TwoFingerEvenE e a Source #
appendOddEEvenA :: TwoFingerOddE e a -> TwoFingerEvenA e a -> TwoFingerOddE e a Source #
appendEvenEOddE :: TwoFingerEvenE e a -> TwoFingerOddE e a -> TwoFingerOddE e a Source #