| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Diverse.CaseIxed
Synopsis
- newtype CaseIxedFunc (k :: Type -> Constraint) r (xs :: [Type]) = CaseIxedFunc (forall f x. k (f x) => f x -> r x)
- newtype CaseIxedFunc_ (k :: Type -> Constraint) f r (xs :: [Type]) = CaseIxedFunc_ (forall x. k (f x) => f x -> r x)
- newtype CaseIxedFunc1 (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) r (xs :: [Type]) = CaseIxedFunc1 (forall f x. (k (f x), k1 f, k0 x) => f x -> r x)
- newtype CaseIxedFunc1_ (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) f r (xs :: [Type]) = CaseIxedFunc1_ (forall x. (k (f x), k1 f, k0 x) => f x -> r x)
- newtype CaseIxedFuncM (k :: Type -> Constraint) r m (xs :: [Type]) = CaseIxedFuncM (forall f x. k (f x) => f x -> m (r x))
- newtype CaseIxedFuncM_ (k :: Type -> Constraint) f r m (xs :: [Type]) = CaseIxedFuncM_ (forall x. k (f x) => f x -> m (r x))
- newtype CaseIxedFuncM1 (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) r m (xs :: [Type]) = CaseIxedFuncM1 (forall f x. (k (f x), k1 f, k0 x) => f x -> m (r x))
- newtype CaseIxedFuncM1_ (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) f r m (xs :: [Type]) = CaseIxedFuncM1_ (forall x. (k (f x), k1 f, k0 x) => f x -> m (r x))
- newtype CaseIxedCont (k :: Type -> Constraint) r (xs :: [Type]) = CaseIxedCont (forall f x. k (f x) => f x -> x -> r)
- newtype CaseIxedCont_ (k :: Type -> Constraint) f r (xs :: [Type]) = CaseIxedCont_ (forall x. k (f x) => f x -> x -> r)
- newtype CaseIxedCont1 (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) r (xs :: [Type]) = CaseIxedCont1 (forall f x. (k (f x), k1 f, k0 x) => f x -> x -> r)
- newtype CaseIxedCont1_ (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) f r (xs :: [Type]) = CaseIxedCont1_ (forall x. (k (f x), k1 f, k0 x) => f x -> x -> r)
Documentation
newtype CaseIxedFunc (k :: Type -> Constraint) r (xs :: [Type]) Source #
This handler stores a polymorphic function which changes the type of the containers.
>>>let f (x :: f a) = Const @String @a $ show x
>>>let xs = (Just @Int 5) ./ Right @Int False ./ "X" ./ (Left @Int @Bool 6) ./ nil
>>>afmap (CasedIxedFunc @Show f) xs :: Many '[Const String Int, Const String Bool, Const String Char, Const String Bool]Const "Just 5" ./ Const "Right False" ./ Const "\"X\"" ./ Const "Left 6" ./ nil
>>>atraverse (CasedIxedFunc @Show f) xs :: Const String (Many '[Int, Bool, Char, Bool])Const "Just 5Right False\"X\"Left 6"
Constructors
| CaseIxedFunc (forall f x. k (f x) => f x -> r x) |
Instances
| Reiterate (CaseIxedFunc k r) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedFunc k r xs -> CaseIxedFunc k r (Tail xs) Source # | |
| k (f x) => Case (CaseIxedFunc k r) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedFunc k r (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedFunc k r) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedFunc k r :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedFunc_ (k :: Type -> Constraint) f r (xs :: [Type]) Source #
A variant of CaseIxedFunc for which the type of both containers is fixed.
Constructors
| CaseIxedFunc_ (forall x. k (f x) => f x -> r x) |
Instances
| Reiterate (CaseIxedFunc_ k f r) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedFunc_ k f r xs -> CaseIxedFunc_ k f r (Tail xs) Source # | |
| k (f x) => Case (CaseIxedFunc_ k f r) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedFunc_ k f r (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedFunc_ k f r) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedFunc_ k f r :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedFunc1 (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) r (xs :: [Type]) Source #
A variant of CaseIxedFunc with more constraints.
>>>let xs = (Just @Int 5) ./ Right @Int False ./ "X" ./ (Left @Int @Bool 6) ./ nil
>>>afmap (CaseIxedFunc1 @C0 @Foldable @C0 toList) xs[5] ./ [False] ./ "X" ./ [] ./ nil
>>>atraverse (CaseIxedFunc1 @C0 @Foldable @C0 toList) xs[]
>>>let ys = (Just @Int 5) ./ Right @Int False ./ "XYZ" ./ nil
>>>atraverse (CaseIxedFunc1 @C0 @Foldable @C0 toList) ys[5 ./ False ./ 'X' ./ nil,5 ./ False ./ 'Y' ./ nil,5 ./ False ./ 'Z' ./ nil]
Constructors
| CaseIxedFunc1 (forall f x. (k (f x), k1 f, k0 x) => f x -> r x) |
Instances
| Reiterate (CaseIxedFunc1 k k1 k0 r) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedFunc1 k k1 k0 r xs -> CaseIxedFunc1 k k1 k0 r (Tail xs) Source # | |
| (k (f x), k1 f, k0 x) => Case (CaseIxedFunc1 k k1 k0 r) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedFunc1 k k1 k0 r (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedFunc1 k k1 k0 r) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedFunc1 k k1 k0 r :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedFunc1_ (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) f r (xs :: [Type]) Source #
A variant of CaseIxedFunc1 for which the type of both containers is fixed.
Constructors
| CaseIxedFunc1_ (forall x. (k (f x), k1 f, k0 x) => f x -> r x) |
Instances
| Reiterate (CaseIxedFunc1_ k k1 k0 f r) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedFunc1_ k k1 k0 f r xs -> CaseIxedFunc1_ k k1 k0 f r (Tail xs) Source # | |
| (k (f x), k1 f, k0 x) => Case (CaseIxedFunc1_ k k1 k0 f r) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedFunc1_ k k1 k0 f r (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedFunc1_ k k1 k0 f r) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedFunc1_ k k1 k0 f r :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedFuncM (k :: Type -> Constraint) r m (xs :: [Type]) Source #
A variant of CaseIxedFunc which maps containers within an additional layer.
>>>let f (x :: f a) = Const @String @a $ show x
>>>let xs = (Just @Int 5) ./ Right @Int False ./ "X" ./ (Left @Int @Bool 6) ./ nil
>>>atraverse (CaseIxedFuncM @Show $ \x -> f x <$ print x) xsJust 5 Right False "X" Left 6 Const "Just 5" ./ Const "Right False" ./ Const "\"X\"" ./ Const "Left 6" ./ nil
Constructors
| CaseIxedFuncM (forall f x. k (f x) => f x -> m (r x)) |
Instances
| Reiterate (CaseIxedFuncM k r m) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedFuncM k r m xs -> CaseIxedFuncM k r m (Tail xs) Source # | |
| k (f x) => Case (CaseIxedFuncM k r m) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedFuncM k r m (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedFuncM k r m) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedFuncM k r m :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedFuncM_ (k :: Type -> Constraint) f r m (xs :: [Type]) Source #
A variant of CaseIxedFuncM for which the type of both containers is fixed.
Constructors
| CaseIxedFuncM_ (forall x. k (f x) => f x -> m (r x)) |
Instances
| Reiterate (CaseIxedFuncM_ k f r m) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedFuncM_ k f r m xs -> CaseIxedFuncM_ k f r m (Tail xs) Source # | |
| k (f x) => Case (CaseIxedFuncM_ k f r m) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedFuncM_ k f r m (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedFuncM_ k f r m) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedFuncM_ k f r m :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedFuncM1 (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) r m (xs :: [Type]) Source #
A variant of CaseIxedFuncM with more constraints.
>>>let xs = (Just @Int 5) ./ Right @Int False ./ "XYZ" ./ nil
>>>atraverse (CaseIxedFuncM1 @C0 @Foldable @C0 @[] @Maybe $ Just . toList) xsJust ([5] ./ [False] ./ "XYZ" ./ nil)
Constructors
| CaseIxedFuncM1 (forall f x. (k (f x), k1 f, k0 x) => f x -> m (r x)) |
Instances
| Reiterate (CaseIxedFuncM1 k k1 k0 r m) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedFuncM1 k k1 k0 r m xs -> CaseIxedFuncM1 k k1 k0 r m (Tail xs) Source # | |
| (k (f x), k1 f, k0 x) => Case (CaseIxedFuncM1 k k1 k0 r m) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedFuncM1 k k1 k0 r m (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedFuncM1 k k1 k0 r m) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedFuncM1 k k1 k0 r m :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedFuncM1_ (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) f r m (xs :: [Type]) Source #
A variant of CaseIxedFuncM1 for which the type of both containers is fixed.
Constructors
| CaseIxedFuncM1_ (forall x. (k (f x), k1 f, k0 x) => f x -> m (r x)) |
Instances
| Reiterate (CaseIxedFuncM1_ k k1 k0 f r m) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedFuncM1_ k k1 k0 f r m xs -> CaseIxedFuncM1_ k k1 k0 f r m (Tail xs) Source # | |
| (k (f x), k1 f, k0 x) => Case (CaseIxedFuncM1_ k k1 k0 f r m) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedFuncM1_ k k1 k0 f r m (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedFuncM1_ k k1 k0 f r m) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedFuncM1_ k k1 k0 f r m :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedCont (k :: Type -> Constraint) r (xs :: [Type]) Source #
This handler stores a polymorphic function which maps containers to continuations.
Constructors
| CaseIxedCont (forall f x. k (f x) => f x -> x -> r) |
Instances
| Reiterate (CaseIxedCont k r) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedCont k r xs -> CaseIxedCont k r (Tail xs) Source # | |
| k (f x) => Case (CaseIxedCont k r) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedCont k r (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedCont k r) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedCont k r :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedCont_ (k :: Type -> Constraint) f r (xs :: [Type]) Source #
A variant of CaseIxedCont for which the type of both containers is fixed.
>>>let ps = Predicate @Int (> 5) ./ Predicate isLetter ./ Predicate id ./ nil
>>>let ps' = cases $ afmap (CaseIxedCont_ @C0 getPredicate) ps
>>>switch (pick @Int @'[Int, Bool, Char] 5) ps' :: BoolFalse
>>>switch (pick @Char @'[Int, Bool, Char] 6) ps' :: BoolTrue
>>>switch (pick @Char @'[Int, Bool, Char] '_') ps' :: BoolFalse
>>>switch (pick @Int @'[Int, Bool, Char] 'a') ps' :: BoolTrue
>>>switch (pick @Bool @'[Int, Bool, Char] False) ps' :: BoolFalse
>>>switch (pick @Bool @'[Int, Bool, Char] True) ps' :: BoolTrue
Constructors
| CaseIxedCont_ (forall x. k (f x) => f x -> x -> r) |
Instances
| Reiterate (CaseIxedCont_ k f r) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedCont_ k f r xs -> CaseIxedCont_ k f r (Tail xs) Source # | |
| k (f x) => Case (CaseIxedCont_ k f r) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedCont_ k f r (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedCont_ k f r) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedCont_ k f r :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedCont1 (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) r (xs :: [Type]) Source #
A variant of CaseIxedCont with more constraints.
Constructors
| CaseIxedCont1 (forall f x. (k (f x), k1 f, k0 x) => f x -> x -> r) |
Instances
| Reiterate (CaseIxedCont1 k k1 k0 r) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedCont1 k k1 k0 r xs -> CaseIxedCont1 k k1 k0 r (Tail xs) Source # | |
| (k (f x), k1 f, k0 x) => Case (CaseIxedCont1 k k1 k0 r) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedCont1 k k1 k0 r (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedCont1 k k1 k0 r) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedCont1 k k1 k0 r :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |
newtype CaseIxedCont1_ (k :: Type -> Constraint) (k1 :: (Type -> Type) -> Constraint) (k0 :: Type -> Constraint) f r (xs :: [Type]) Source #
A variant of CaseIxedCont1_ for which the type of both containers is fixed.
Constructors
| CaseIxedCont1_ (forall x. (k (f x), k1 f, k0 x) => f x -> x -> r) |
Instances
| Reiterate (CaseIxedCont1_ k k1 k0 f r) xs Source # | |
Defined in Data.Diverse.CaseIxed Methods reiterate :: CaseIxedCont1_ k k1 k0 f r xs -> CaseIxedCont1_ k k1 k0 f r (Tail xs) Source # | |
| (k (f x), k1 f, k0 x) => Case (CaseIxedCont1_ k k1 k0 f r) (f x ': xs) Source # | |
Defined in Data.Diverse.CaseIxed Methods case' :: CaseIxedCont1_ k k1 k0 f r (f x ': xs) -> Head (f x ': xs) -> CaseResult (CaseIxedCont1_ k k1 k0 f r) (Head (f x ': xs)) Source # | |
| type CaseResult (CaseIxedCont1_ k k1 k0 f r :: [Type] -> TYPE LiftedRep) (f x :: Type) Source # | |
Defined in Data.Diverse.CaseIxed | |