{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
module Distribution.Solver.Modular.Tree
( POption(..)
, Tree(..)
, TreeF(..)
, Weight
, FailReason(..)
, ConflictingDep(..)
, ana
, cata
, inn
, innM
, para
, trav
, zeroOrOneChoices
, active
, TreeTrav
, EndoTreeTrav
) where
import Control.Monad hiding (mapM, sequence)
import Data.Foldable
import Data.Traversable
import Prelude hiding (foldr, mapM, sequence)
import Distribution.Solver.Modular.Dependency
import Distribution.Solver.Modular.Flag
import Distribution.Solver.Modular.Package
import Distribution.Solver.Modular.PSQ (PSQ)
import Distribution.Solver.Modular.Version
import Distribution.Solver.Modular.WeightedPSQ (WeightedPSQ)
import qualified Distribution.Solver.Modular.WeightedPSQ as W
import Distribution.Solver.Types.ConstraintSource
import Distribution.Solver.Types.Flag
import Distribution.Solver.Types.PackagePath
import Distribution.Types.PkgconfigVersionRange
import Distribution.Types.UnitId (UnitId)
import Language.Haskell.Extension (Extension, Language)
type Weight = Double
data Tree d c =
PChoice QPN RevDepMap c (WeightedPSQ [Weight] POption (Tree d c))
| FChoice QFN RevDepMap c WeakOrTrivial FlagType Bool (WeightedPSQ [Weight] Bool (Tree d c))
| SChoice QSN RevDepMap c WeakOrTrivial (WeightedPSQ [Weight] Bool (Tree d c))
| GoalChoice RevDepMap (PSQ (Goal QPN) (Tree d c))
| Done RevDepMap d
| Fail ConflictSet FailReason
data POption = POption I (Maybe PackagePath)
deriving (POption -> POption -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: POption -> POption -> Bool
$c/= :: POption -> POption -> Bool
== :: POption -> POption -> Bool
$c== :: POption -> POption -> Bool
Eq, Int -> POption -> ShowS
[POption] -> ShowS
POption -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [POption] -> ShowS
$cshowList :: [POption] -> ShowS
show :: POption -> String
$cshow :: POption -> String
showsPrec :: Int -> POption -> ShowS
$cshowsPrec :: Int -> POption -> ShowS
Show)
data FailReason = UnsupportedExtension Extension
| UnsupportedLanguage Language
| MissingPkgconfigPackage PkgconfigName PkgconfigVersionRange
| NewPackageDoesNotMatchExistingConstraint ConflictingDep
| ConflictingConstraints ConflictingDep ConflictingDep
| NewPackageIsMissingRequiredComponent ExposedComponent (DependencyReason QPN)
| NewPackageHasPrivateRequiredComponent ExposedComponent (DependencyReason QPN)
| NewPackageHasUnbuildableRequiredComponent ExposedComponent (DependencyReason QPN)
| PackageRequiresMissingComponent QPN ExposedComponent
| PackageRequiresPrivateComponent QPN ExposedComponent
| PackageRequiresUnbuildableComponent QPN ExposedComponent
| CannotInstall
| CannotReinstall
| NotExplicit
| Shadowed
| Broken UnitId
| UnknownPackage
| GlobalConstraintVersion VR ConstraintSource
| GlobalConstraintInstalled ConstraintSource
| GlobalConstraintSource ConstraintSource
| GlobalConstraintFlag ConstraintSource
| ManualFlag
| MalformedFlagChoice QFN
| MalformedStanzaChoice QSN
| EmptyGoalChoice
| Backjump
| MultipleInstances
| DependenciesNotLinked String
| CyclicDependencies
| UnsupportedSpecVer Ver
deriving (FailReason -> FailReason -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailReason -> FailReason -> Bool
$c/= :: FailReason -> FailReason -> Bool
== :: FailReason -> FailReason -> Bool
$c== :: FailReason -> FailReason -> Bool
Eq, Int -> FailReason -> ShowS
[FailReason] -> ShowS
FailReason -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailReason] -> ShowS
$cshowList :: [FailReason] -> ShowS
show :: FailReason -> String
$cshow :: FailReason -> String
showsPrec :: Int -> FailReason -> ShowS
$cshowsPrec :: Int -> FailReason -> ShowS
Show)
data ConflictingDep = ConflictingDep (DependencyReason QPN) (PkgComponent QPN) CI
deriving (ConflictingDep -> ConflictingDep -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConflictingDep -> ConflictingDep -> Bool
$c/= :: ConflictingDep -> ConflictingDep -> Bool
== :: ConflictingDep -> ConflictingDep -> Bool
$c== :: ConflictingDep -> ConflictingDep -> Bool
Eq, Int -> ConflictingDep -> ShowS
[ConflictingDep] -> ShowS
ConflictingDep -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConflictingDep] -> ShowS
$cshowList :: [ConflictingDep] -> ShowS
show :: ConflictingDep -> String
$cshow :: ConflictingDep -> String
showsPrec :: Int -> ConflictingDep -> ShowS
$cshowsPrec :: Int -> ConflictingDep -> ShowS
Show)
data TreeF d c a =
PChoiceF QPN RevDepMap c (WeightedPSQ [Weight] POption a)
| FChoiceF QFN RevDepMap c WeakOrTrivial FlagType Bool (WeightedPSQ [Weight] Bool a)
| SChoiceF QSN RevDepMap c WeakOrTrivial (WeightedPSQ [Weight] Bool a)
| GoalChoiceF RevDepMap (PSQ (Goal QPN) a)
| DoneF RevDepMap d
| FailF ConflictSet FailReason
deriving (forall a b. a -> TreeF d c b -> TreeF d c a
forall a b. (a -> b) -> TreeF d c a -> TreeF d c b
forall d c a b. a -> TreeF d c b -> TreeF d c a
forall d c a b. (a -> b) -> TreeF d c a -> TreeF d c b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> TreeF d c b -> TreeF d c a
$c<$ :: forall d c a b. a -> TreeF d c b -> TreeF d c a
fmap :: forall a b. (a -> b) -> TreeF d c a -> TreeF d c b
$cfmap :: forall d c a b. (a -> b) -> TreeF d c a -> TreeF d c b
Functor, forall a. TreeF d c a -> Bool
forall m a. Monoid m => (a -> m) -> TreeF d c a -> m
forall a b. (a -> b -> b) -> b -> TreeF d c a -> b
forall d c a. Eq a => a -> TreeF d c a -> Bool
forall d c a. Num a => TreeF d c a -> a
forall d c a. Ord a => TreeF d c a -> a
forall d c m. Monoid m => TreeF d c m -> m
forall d c a. TreeF d c a -> Bool
forall d c a. TreeF d c a -> Int
forall d c a. TreeF d c a -> [a]
forall d c a. (a -> a -> a) -> TreeF d c a -> a
forall d c m a. Monoid m => (a -> m) -> TreeF d c a -> m
forall d c b a. (b -> a -> b) -> b -> TreeF d c a -> b
forall d c a b. (a -> b -> b) -> b -> TreeF d c a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => TreeF d c a -> a
$cproduct :: forall d c a. Num a => TreeF d c a -> a
sum :: forall a. Num a => TreeF d c a -> a
$csum :: forall d c a. Num a => TreeF d c a -> a
minimum :: forall a. Ord a => TreeF d c a -> a
$cminimum :: forall d c a. Ord a => TreeF d c a -> a
maximum :: forall a. Ord a => TreeF d c a -> a
$cmaximum :: forall d c a. Ord a => TreeF d c a -> a
elem :: forall a. Eq a => a -> TreeF d c a -> Bool
$celem :: forall d c a. Eq a => a -> TreeF d c a -> Bool
length :: forall a. TreeF d c a -> Int
$clength :: forall d c a. TreeF d c a -> Int
null :: forall a. TreeF d c a -> Bool
$cnull :: forall d c a. TreeF d c a -> Bool
toList :: forall a. TreeF d c a -> [a]
$ctoList :: forall d c a. TreeF d c a -> [a]
foldl1 :: forall a. (a -> a -> a) -> TreeF d c a -> a
$cfoldl1 :: forall d c a. (a -> a -> a) -> TreeF d c a -> a
foldr1 :: forall a. (a -> a -> a) -> TreeF d c a -> a
$cfoldr1 :: forall d c a. (a -> a -> a) -> TreeF d c a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> TreeF d c a -> b
$cfoldl' :: forall d c b a. (b -> a -> b) -> b -> TreeF d c a -> b
foldl :: forall b a. (b -> a -> b) -> b -> TreeF d c a -> b
$cfoldl :: forall d c b a. (b -> a -> b) -> b -> TreeF d c a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> TreeF d c a -> b
$cfoldr' :: forall d c a b. (a -> b -> b) -> b -> TreeF d c a -> b
foldr :: forall a b. (a -> b -> b) -> b -> TreeF d c a -> b
$cfoldr :: forall d c a b. (a -> b -> b) -> b -> TreeF d c a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> TreeF d c a -> m
$cfoldMap' :: forall d c m a. Monoid m => (a -> m) -> TreeF d c a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> TreeF d c a -> m
$cfoldMap :: forall d c m a. Monoid m => (a -> m) -> TreeF d c a -> m
fold :: forall m. Monoid m => TreeF d c m -> m
$cfold :: forall d c m. Monoid m => TreeF d c m -> m
Foldable, forall d c. Functor (TreeF d c)
forall d c. Foldable (TreeF d c)
forall d c (m :: * -> *) a.
Monad m =>
TreeF d c (m a) -> m (TreeF d c a)
forall d c (f :: * -> *) a.
Applicative f =>
TreeF d c (f a) -> f (TreeF d c a)
forall d c (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TreeF d c a -> m (TreeF d c b)
forall d c (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TreeF d c a -> f (TreeF d c b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TreeF d c a -> f (TreeF d c b)
sequence :: forall (m :: * -> *) a.
Monad m =>
TreeF d c (m a) -> m (TreeF d c a)
$csequence :: forall d c (m :: * -> *) a.
Monad m =>
TreeF d c (m a) -> m (TreeF d c a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TreeF d c a -> m (TreeF d c b)
$cmapM :: forall d c (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TreeF d c a -> m (TreeF d c b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
TreeF d c (f a) -> f (TreeF d c a)
$csequenceA :: forall d c (f :: * -> *) a.
Applicative f =>
TreeF d c (f a) -> f (TreeF d c a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TreeF d c a -> f (TreeF d c b)
$ctraverse :: forall d c (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TreeF d c a -> f (TreeF d c b)
Traversable)
out :: Tree d c -> TreeF d c (Tree d c)
out :: forall d c. Tree d c -> TreeF d c (Tree d c)
out (PChoice QPN
p RevDepMap
s c
i WeightedPSQ [Weight] POption (Tree d c)
ts) = forall d c a.
QPN
-> RevDepMap -> c -> WeightedPSQ [Weight] POption a -> TreeF d c a
PChoiceF QPN
p RevDepMap
s c
i WeightedPSQ [Weight] POption (Tree d c)
ts
out (FChoice QFN
p RevDepMap
s c
i WeakOrTrivial
b FlagType
m Bool
d WeightedPSQ [Weight] Bool (Tree d c)
ts) = forall d c a.
QFN
-> RevDepMap
-> c
-> WeakOrTrivial
-> FlagType
-> Bool
-> WeightedPSQ [Weight] Bool a
-> TreeF d c a
FChoiceF QFN
p RevDepMap
s c
i WeakOrTrivial
b FlagType
m Bool
d WeightedPSQ [Weight] Bool (Tree d c)
ts
out (SChoice QSN
p RevDepMap
s c
i WeakOrTrivial
b WeightedPSQ [Weight] Bool (Tree d c)
ts) = forall d c a.
QSN
-> RevDepMap
-> c
-> WeakOrTrivial
-> WeightedPSQ [Weight] Bool a
-> TreeF d c a
SChoiceF QSN
p RevDepMap
s c
i WeakOrTrivial
b WeightedPSQ [Weight] Bool (Tree d c)
ts
out (GoalChoice RevDepMap
s PSQ (Goal QPN) (Tree d c)
ts) = forall d c a. RevDepMap -> PSQ (Goal QPN) a -> TreeF d c a
GoalChoiceF RevDepMap
s PSQ (Goal QPN) (Tree d c)
ts
out (Done RevDepMap
x d
s ) = forall d c a. RevDepMap -> d -> TreeF d c a
DoneF RevDepMap
x d
s
out (Fail ConflictSet
c FailReason
x ) = forall d c a. ConflictSet -> FailReason -> TreeF d c a
FailF ConflictSet
c FailReason
x
inn :: TreeF d c (Tree d c) -> Tree d c
inn :: forall d c. TreeF d c (Tree d c) -> Tree d c
inn (PChoiceF QPN
p RevDepMap
s c
i WeightedPSQ [Weight] POption (Tree d c)
ts) = forall d c.
QPN
-> RevDepMap
-> c
-> WeightedPSQ [Weight] POption (Tree d c)
-> Tree d c
PChoice QPN
p RevDepMap
s c
i WeightedPSQ [Weight] POption (Tree d c)
ts
inn (FChoiceF QFN
p RevDepMap
s c
i WeakOrTrivial
b FlagType
m Bool
d WeightedPSQ [Weight] Bool (Tree d c)
ts) = forall d c.
QFN
-> RevDepMap
-> c
-> WeakOrTrivial
-> FlagType
-> Bool
-> WeightedPSQ [Weight] Bool (Tree d c)
-> Tree d c
FChoice QFN
p RevDepMap
s c
i WeakOrTrivial
b FlagType
m Bool
d WeightedPSQ [Weight] Bool (Tree d c)
ts
inn (SChoiceF QSN
p RevDepMap
s c
i WeakOrTrivial
b WeightedPSQ [Weight] Bool (Tree d c)
ts) = forall d c.
QSN
-> RevDepMap
-> c
-> WeakOrTrivial
-> WeightedPSQ [Weight] Bool (Tree d c)
-> Tree d c
SChoice QSN
p RevDepMap
s c
i WeakOrTrivial
b WeightedPSQ [Weight] Bool (Tree d c)
ts
inn (GoalChoiceF RevDepMap
s PSQ (Goal QPN) (Tree d c)
ts) = forall d c. RevDepMap -> PSQ (Goal QPN) (Tree d c) -> Tree d c
GoalChoice RevDepMap
s PSQ (Goal QPN) (Tree d c)
ts
inn (DoneF RevDepMap
x d
s ) = forall d c. RevDepMap -> d -> Tree d c
Done RevDepMap
x d
s
inn (FailF ConflictSet
c FailReason
x ) = forall d c. ConflictSet -> FailReason -> Tree d c
Fail ConflictSet
c FailReason
x
innM :: Monad m => TreeF d c (m (Tree d c)) -> m (Tree d c)
innM :: forall (m :: * -> *) d c.
Monad m =>
TreeF d c (m (Tree d c)) -> m (Tree d c)
innM (PChoiceF QPN
p RevDepMap
s c
i WeightedPSQ [Weight] POption (m (Tree d c))
ts) = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (forall d c.
QPN
-> RevDepMap
-> c
-> WeightedPSQ [Weight] POption (Tree d c)
-> Tree d c
PChoice QPN
p RevDepMap
s c
i ) (forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence WeightedPSQ [Weight] POption (m (Tree d c))
ts)
innM (FChoiceF QFN
p RevDepMap
s c
i WeakOrTrivial
b FlagType
m Bool
d WeightedPSQ [Weight] Bool (m (Tree d c))
ts) = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (forall d c.
QFN
-> RevDepMap
-> c
-> WeakOrTrivial
-> FlagType
-> Bool
-> WeightedPSQ [Weight] Bool (Tree d c)
-> Tree d c
FChoice QFN
p RevDepMap
s c
i WeakOrTrivial
b FlagType
m Bool
d) (forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence WeightedPSQ [Weight] Bool (m (Tree d c))
ts)
innM (SChoiceF QSN
p RevDepMap
s c
i WeakOrTrivial
b WeightedPSQ [Weight] Bool (m (Tree d c))
ts) = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (forall d c.
QSN
-> RevDepMap
-> c
-> WeakOrTrivial
-> WeightedPSQ [Weight] Bool (Tree d c)
-> Tree d c
SChoice QSN
p RevDepMap
s c
i WeakOrTrivial
b ) (forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence WeightedPSQ [Weight] Bool (m (Tree d c))
ts)
innM (GoalChoiceF RevDepMap
s PSQ (Goal QPN) (m (Tree d c))
ts) = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (forall d c. RevDepMap -> PSQ (Goal QPN) (Tree d c) -> Tree d c
GoalChoice RevDepMap
s ) (forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence PSQ (Goal QPN) (m (Tree d c))
ts)
innM (DoneF RevDepMap
x d
s ) = forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall d c. RevDepMap -> d -> Tree d c
Done RevDepMap
x d
s
innM (FailF ConflictSet
c FailReason
x ) = forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall d c. ConflictSet -> FailReason -> Tree d c
Fail ConflictSet
c FailReason
x
active :: Tree d c -> Bool
active :: forall d c. Tree d c -> Bool
active (Fail ConflictSet
_ FailReason
_) = Bool
False
active Tree d c
_ = Bool
True
zeroOrOneChoices :: Tree d c -> Bool
zeroOrOneChoices :: forall d c. Tree d c -> Bool
zeroOrOneChoices (PChoice QPN
_ RevDepMap
_ c
_ WeightedPSQ [Weight] POption (Tree d c)
ts) = forall w k v. WeightedPSQ w k v -> Bool
W.isZeroOrOne (forall v k w. (v -> Bool) -> WeightedPSQ k w v -> WeightedPSQ k w v
W.filter forall d c. Tree d c -> Bool
active WeightedPSQ [Weight] POption (Tree d c)
ts)
zeroOrOneChoices (FChoice QFN
_ RevDepMap
_ c
_ WeakOrTrivial
_ FlagType
_ Bool
_ WeightedPSQ [Weight] Bool (Tree d c)
ts) = forall w k v. WeightedPSQ w k v -> Bool
W.isZeroOrOne (forall v k w. (v -> Bool) -> WeightedPSQ k w v -> WeightedPSQ k w v
W.filter forall d c. Tree d c -> Bool
active WeightedPSQ [Weight] Bool (Tree d c)
ts)
zeroOrOneChoices (SChoice QSN
_ RevDepMap
_ c
_ WeakOrTrivial
_ WeightedPSQ [Weight] Bool (Tree d c)
ts) = forall w k v. WeightedPSQ w k v -> Bool
W.isZeroOrOne (forall v k w. (v -> Bool) -> WeightedPSQ k w v -> WeightedPSQ k w v
W.filter forall d c. Tree d c -> Bool
active WeightedPSQ [Weight] Bool (Tree d c)
ts)
zeroOrOneChoices (GoalChoice RevDepMap
_ PSQ (Goal QPN) (Tree d c)
_ ) = Bool
True
zeroOrOneChoices (Done RevDepMap
_ d
_ ) = Bool
True
zeroOrOneChoices (Fail ConflictSet
_ FailReason
_ ) = Bool
True
cata :: (TreeF d c a -> a) -> Tree d c -> a
cata :: forall d c a. (TreeF d c a -> a) -> Tree d c -> a
cata TreeF d c a -> a
phi Tree d c
x = (TreeF d c a -> a
phi forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall d c a. (TreeF d c a -> a) -> Tree d c -> a
cata TreeF d c a -> a
phi) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d c. Tree d c -> TreeF d c (Tree d c)
out) Tree d c
x
type TreeTrav d c a = TreeF d c (Tree d a) -> TreeF d a (Tree d a)
type EndoTreeTrav d c = TreeTrav d c c
trav :: TreeTrav d c a -> Tree d c -> Tree d a
trav :: forall d c a. TreeTrav d c a -> Tree d c -> Tree d a
trav TreeTrav d c a
psi Tree d c
x = forall d c a. (TreeF d c a -> a) -> Tree d c -> a
cata (forall d c. TreeF d c (Tree d c) -> Tree d c
inn forall b c a. (b -> c) -> (a -> b) -> a -> c
. TreeTrav d c a
psi) Tree d c
x
para :: (TreeF d c (a, Tree d c) -> a) -> Tree d c -> a
para :: forall d c a. (TreeF d c (a, Tree d c) -> a) -> Tree d c -> a
para TreeF d c (a, Tree d c) -> a
phi = TreeF d c (a, Tree d c) -> a
phi forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\ Tree d c
x -> (forall d c a. (TreeF d c (a, Tree d c) -> a) -> Tree d c -> a
para TreeF d c (a, Tree d c) -> a
phi Tree d c
x, Tree d c
x)) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d c. Tree d c -> TreeF d c (Tree d c)
out
ana :: (a -> TreeF d c a) -> a -> Tree d c
ana :: forall a d c. (a -> TreeF d c a) -> a -> Tree d c
ana a -> TreeF d c a
psi = forall d c. TreeF d c (Tree d c) -> Tree d c
inn forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall a d c. (a -> TreeF d c a) -> a -> Tree d c
ana a -> TreeF d c a
psi) forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> TreeF d c a
psi