Safe Haskell | None |
---|---|
Language | Haskell2010 |
Usage example with template haskell support.
Synopsis
- data Rose a
- value1 :: Rose Int
- value2 :: Rose Int
- value3 :: Rose Int
- value4 :: Rose Int
- type FamRoseInt = '[Rose Int, [Rose Int]]
- type CodesRoseInt = '['['[K KInt, I (S Z)], '[K KInt]], '['[], '[I Z, I (S Z)]]]
- pattern ListRoseInt_Ifx1 :: phi Z -> phi (S Z) -> View kon phi (Lkup (S Z) CodesRoseInt)
- pattern ListRoseInt_Ifx0 :: View kon phi (Lkup (S Z) CodesRoseInt)
- pattern RoseIntLeaf_ :: kon KInt -> View kon phi (Lkup Z CodesRoseInt)
- pattern RoseInt_Ifx0 :: kon KInt -> phi (S Z) -> View kon phi (Lkup Z CodesRoseInt)
- pattern IdxListRoseInt :: forall (a :: Nat). () => forall (n :: Nat). (a ~# S n, n ~# Z) => SNat a
- pattern IdxRoseInt :: forall (a :: Nat). () => a ~# Z => SNat a
- tyInfo_1 :: [Char]
- tyInfo_0 :: [Char]
- testEq :: Bool
- normalize :: Rose Int -> Rose Int
- sumTree :: Rose Int -> Int
- testSum :: Bool
Defining the datatype
First, we will start off defining a variant of your standard Rose trees.
The Leaf
constructor adds some redundancy on purpose, so we can
later use the combinators in the library to remove that redundancy.
Rose trees with redundancy.
Instances
Family Singl FamRoseInt CodesRoseInt Source # | |
Defined in Generics.MRSOP.Examples.RoseTreeTH sfrom' :: SNat ix -> El FamRoseInt ix -> Rep Singl (El FamRoseInt) (Lkup ix CodesRoseInt) Source # sto' :: SNat ix -> Rep Singl (El FamRoseInt) (Lkup ix CodesRoseInt) -> El FamRoseInt ix Source # | |
HasDatatypeInfo Singl FamRoseInt CodesRoseInt Source # | |
Defined in Generics.MRSOP.Examples.RoseTreeTH datatypeInfo :: Proxy FamRoseInt -> SNat ix -> DatatypeInfo (Lkup ix CodesRoseInt) Source # | |
Eq (Rose Int) Source # | Equality is defined using |
Show a => Show (Rose a) Source # | |
pattern ListRoseInt_Ifx0 :: View kon phi (Lkup (S Z) CodesRoseInt) Source #
pattern RoseIntLeaf_ :: kon KInt -> View kon phi (Lkup Z CodesRoseInt) Source #
pattern RoseInt_Ifx0 :: kon KInt -> phi (S Z) -> View kon phi (Lkup Z CodesRoseInt) Source #
pattern IdxListRoseInt :: forall (a :: Nat). () => forall (n :: Nat). (a ~# S n, n ~# Z) => SNat a Source #
Eq Instance
Compos test
Crush test
The sum of a tree should be the same as the sum of a normalized tree;
This should return True
.
Orphan instances
Family Singl FamRoseInt CodesRoseInt Source # | |
sfrom' :: SNat ix -> El FamRoseInt ix -> Rep Singl (El FamRoseInt) (Lkup ix CodesRoseInt) Source # sto' :: SNat ix -> Rep Singl (El FamRoseInt) (Lkup ix CodesRoseInt) -> El FamRoseInt ix Source # |