createShortcut :: Exp FilePath -> [Attrib] -> Action ()
createShortcut name as = do Value name <- name; x <- foldM f def{scFile=name} as; emit $ CreateShortcut x
    where
        f c (Target x) = do Value x <- x; return c{scTarget=x}
        f c (Parameters x) = do Value x <- x; return c{scParameters=x}
        f c (IconFile x) = do Value x <- x; return c{scIconFile=x}
        f c (IconIndex x) = do Value x <- x; return c{scIconIndex=x}
        f c (StartOptions x) = return c{scStartOptions=x}
        f c (KeyboardShortcut x) = return c{scKeyboardShortcut=x}
        f c (Description x) = do Value x <- x; return c{scDescription=x}
        f c x = error $ "Invalid attribute to shortcut: " ++ show x
createShortcut :: Exp FilePath -> [Attrib] -> Action ()
createShortcut name as = do Value name <- name; x <- foldM f def{scFile=name} as; emit $ CreateShortcut x
    where
        f c (Target x) = do Value x <- x; return c{scTarget=x}
        f c (Parameters x) = do Value x <- x; return c{scParameters=x}
        f c (IconFile x) = do Value x <- x; return c{scIconFile=x}
        f c (IconIndex x) = do Value x <- x; return c{scIconIndex=x}
        f c (StartOptions x) = return c{scStartOptions=x}
        f c (KeyboardShortcut x) = return c{scKeyboardShortcut=x}
        f c (Description x) = do Value x <- x; return c{scDescription=x}
        f c x = error $ "Invalid attribute to shortcut: " ++ show x
createShortcut name as = do Value name <- name; x <- foldM f def{scFile=name} as; emit $ CreateShortcut x
    where
        f c (Target x) = do Value x <- x; return c{scTarget=x}
        f c (Parameters x) = do Value x <- x; return c{scParameters=x}
        f c (IconFile x) = do Value x <- x; return c{scIconFile=x}
        f c (IconIndex x) = do Value x <- x; return c{scIconIndex=x}
        f c (StartOptions x) = return c{scStartOptions=x}
        f c (KeyboardShortcut x) = return c{scKeyboardShortcut=x}
        f c (Description x) = do Value x <- x; return c{scDescription=x}
        f c x = error $ "Invalid attribute to shortcut: " ++ show x