sectionGroup :: Exp String -> [Attrib] -> Action () -> Action SectionId
sectionGroup name as act = do
    sec <- newSectionId
    Value name <- name
    (xs, _) <- capture $ scope act
    x <- foldM f def{secgId=sec, secgName=name} as
    emit $ SectionGroup x xs
    return $ secgId x
    where
        f c Expanded = return c{secgExpanded=True}
        f c (Description x) = do Value x <- x; return c{secgDescription=x}
        f c (Id x) = return c{secgId=x}
        f c x = error $ "Invalid attribute to sectionGroup: " ++ show x
sectionGroup :: Exp String -> [Attrib] -> Action () -> Action SectionId
sectionGroup name as act = do
    sec <- newSectionId
    Value name <- name
    (xs, _) <- capture $ scope act
    x <- foldM f def{secgId=sec, secgName=name} as
    emit $ SectionGroup x xs
    return $ secgId x
    where
        f c Expanded = return c{secgExpanded=True}
        f c (Description x) = do Value x <- x; return c{secgDescription=x}
        f c (Id x) = return c{secgId=x}
        f c x = error $ "Invalid attribute to sectionGroup: " ++ show x
sectionGroup name as act = do
    sec <- newSectionId
    Value name <- name
    (xs, _) <- capture $ scope act
    x <- foldM f def{secgId=sec, secgName=name} as
    emit $ SectionGroup x xs
    return $ secgId x
    where
        f c Expanded = return c{secgExpanded=True}
        f c (Description x) = do Value x <- x; return c{secgDescription=x}
        f c (Id x) = return c{secgId=x}
        f c x = error $ "Invalid attribute to sectionGroup: " ++ show x