copyFiles :: [Attrib] -> Exp FilePath -> Exp FilePath -> Action ()
copyFiles as from to = do
    Value from <- from
    Value to <- to
    emit $ CopyFiles $ foldl f def{cpFrom=from, cpTo=to} as
    where
        f c Silent = c{cpSilent=True}
        f c FilesOnly = c{cpFilesOnly=True}
        f c x = error $ "Invalid attribute to copyFiles: " ++ show x

-- | Creates a shortcut file that links to a 'Traget' file, with optional 'Parameters'. The icon used for the shortcut
--   is 'IconFile','IconIndex'. 'StartOptions' should be one of: SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED.
--   'KeyboardShortcut' should be in the form of 'flag|c' where flag can be a combination (using |) of: ALT, CONTROL, EXT, or SHIFT.
--   c is the character to use (a-z, A-Z, 0-9, F1-F24, etc). Note that no spaces are allowed in this string. A good example is
--   \"ALT|CONTROL|F8\". @$OUTDIR@ is used for the working directory. You can change it by using 'setOutPath' before creating
--   the Shortcut. 'Description' should be the description of the shortcut, or comment as it is called under XP.
--   The error flag is set if the shortcut cannot be created (i.e. either of the paths (link or target) does not exist, or some other error).
--
-- > createDirectory "$SMPROGRAMS/My Company"
-- > createShortcut "$SMPROGRAMS/My Company/My Program.lnk"
-- >    [Target "$INSTDIR/My Program.exe"
-- >    ,Parameters "some command line parameters"
-- >    ,IconFile "$INSTDIR/My Program.exe", IconIndex 2
-- >    ,StartOptions "SW_SHOWNORMAL"
-- >    ,KeyboardShortcut "ALT|CONTROL|SHIFT|F5"
-- >    ,Description "a description"]
copyFiles :: [Attrib] -> Exp FilePath -> Exp FilePath -> Action ()
copyFiles as from to = do
    Value from <- from
    Value to <- to
    emit $ CopyFiles $ foldl f def{cpFrom=from, cpTo=to} as
    where
        f c Silent = c{cpSilent=True}
        f c FilesOnly = c{cpFilesOnly=True}
        f c x = error $ "Invalid attribute to copyFiles: " ++ show x

-- | Creates a shortcut file that links to a 'Traget' file, with optional 'Parameters'. The icon used for the shortcut
--   is 'IconFile','IconIndex'. 'StartOptions' should be one of: SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED.
--   'KeyboardShortcut' should be in the form of 'flag|c' where flag can be a combination (using |) of: ALT, CONTROL, EXT, or SHIFT.
--   c is the character to use (a-z, A-Z, 0-9, F1-F24, etc). Note that no spaces are allowed in this string. A good example is
--   \"ALT|CONTROL|F8\". @$OUTDIR@ is used for the working directory. You can change it by using 'setOutPath' before creating
--   the Shortcut. 'Description' should be the description of the shortcut, or comment as it is called under XP.
--   The error flag is set if the shortcut cannot be created (i.e. either of the paths (link or target) does not exist, or some other error).
--
-- > createDirectory "$SMPROGRAMS/My Company"
-- > createShortcut "$SMPROGRAMS/My Company/My Program.lnk"
-- >    [Target "$INSTDIR/My Program.exe"
-- >    ,Parameters "some command line parameters"
-- >    ,IconFile "$INSTDIR/My Program.exe", IconIndex 2
-- >    ,StartOptions "SW_SHOWNORMAL"
-- >    ,KeyboardShortcut "ALT|CONTROL|SHIFT|F5"
-- >    ,Description "a description"]
copyFiles as from to = do
    Value from <- from
    Value to <- to
    emit $ CopyFiles $ foldl f def{cpFrom=from, cpTo=to} as
    where
        f c Silent = c{cpSilent=True}
        f c FilesOnly = c{cpFilesOnly=True}
        f c x = error $ "Invalid attribute to copyFiles: " ++ show x

-- | Creates a shortcut file that links to a 'Traget' file, with optional 'Parameters'. The icon used for the shortcut
--   is 'IconFile','IconIndex'. 'StartOptions' should be one of: SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED.
--   'KeyboardShortcut' should be in the form of 'flag|c' where flag can be a combination (using |) of: ALT, CONTROL, EXT, or SHIFT.
--   c is the character to use (a-z, A-Z, 0-9, F1-F24, etc). Note that no spaces are allowed in this string. A good example is
--   \"ALT|CONTROL|F8\". @$OUTDIR@ is used for the working directory. You can change it by using 'setOutPath' before creating
--   the Shortcut. 'Description' should be the description of the shortcut, or comment as it is called under XP.
--   The error flag is set if the shortcut cannot be created (i.e. either of the paths (link or target) does not exist, or some other error).
--
-- > createDirectory "$SMPROGRAMS/My Company"
-- > createShortcut "$SMPROGRAMS/My Company/My Program.lnk"
-- >    [Target "$INSTDIR/My Program.exe"
-- >    ,Parameters "some command line parameters"
-- >    ,IconFile "$INSTDIR/My Program.exe", IconIndex 2
-- >    ,StartOptions "SW_SHOWNORMAL"
-- >    ,KeyboardShortcut "ALT|CONTROL|SHIFT|F5"
-- >    ,Description "a description"]