bool :: forall a. Arith a => a -> Gen (NodeBuilder Bool)
bool _ = sized tree'
  where tree' 0 = return . Const <$> arbitrary
        tree' n = oneof [return . Const <$> arbitrary,
                         mkCondM <$> subCond <*> arbitrary <*> subCond,
                         mkIfM <$> subBool <*> subBool <*> subBool
                        ]
          where subCond = resize (n `div` 2) (arith :: Gen (NodeBuilder a))
                subBool = tree' (n `div` 3)
bool :: forall a. Arith a => a -> Gen (NodeBuilder Bool)
bool _ = sized tree'
  where tree' 0 = return . Const <$> arbitrary
        tree' n = oneof [return . Const <$> arbitrary,
                         mkCondM <$> subCond <*> arbitrary <*> subCond,
                         mkIfM <$> subBool <*> subBool <*> subBool
                        ]
          where subCond = resize (n `div` 2) (arith :: Gen (NodeBuilder a))
                subBool = tree' (n `div` 3)
bool _ = sized tree'
  where tree' 0 = return . Const <$> arbitrary
        tree' n = oneof [return . Const <$> arbitrary,
                         mkCondM <$> subCond <*> arbitrary <*> subCond,
                         mkIfM <$> subBool <*> subBool <*> subBool
                        ]
          where subCond = resize (n `div` 2) (arith :: Gen (NodeBuilder a))
                subBool = tree' (n `div` 3)