unlessExists -> whenExists
This commit is contained in:
parent
3f363b5415
commit
3c9b1da592
@ -172,12 +172,12 @@ juliusFile =
|
||||
|
||||
widgetFile :: FilePath -> Q Exp
|
||||
widgetFile x = do
|
||||
let h = unlessExists (globFile "hamlet") (whamletFile . globFile "hamlet")
|
||||
let c = unlessExists (globFile "cassius") cassiusFile
|
||||
let j = unlessExists (globFile "julius") juliusFile
|
||||
let l = unlessExists (globFile "lucius") luciusFile
|
||||
let h = whenExists (globFile "hamlet") (whamletFile . globFile "hamlet")
|
||||
let c = whenExists (globFile "cassius") cassiusFile
|
||||
let j = whenExists (globFile "julius") juliusFile
|
||||
let l = whenExists (globFile "lucius") luciusFile
|
||||
[|addWidget $h >> addCassius $c >> addJulius $j >> addLucius $l|]
|
||||
where
|
||||
unlessExists tofn f = do
|
||||
whenExists tofn f = do
|
||||
e <- qRunIO $ doesFileExist $ tofn x
|
||||
if e then f x else [|mempty|]
|
||||
|
||||
@ -142,12 +142,12 @@ juliusFile = H.juliusFileDebug . toJuliusFile
|
||||
|
||||
widgetFile :: FilePath -> Q Exp
|
||||
widgetFile x = do
|
||||
let h = unlessExists toHamletFile $ whamletFile . toHamletFile
|
||||
let c = unlessExists toCassiusFile cassiusFile
|
||||
let j = unlessExists toJuliusFile juliusFile
|
||||
let l = unlessExists toLuciusFile luciusFile
|
||||
let h = whenExists toHamletFile $ whamletFile . toHamletFile
|
||||
let c = whenExists toCassiusFile cassiusFile
|
||||
let j = whenExists toJuliusFile juliusFile
|
||||
let l = whenExists toLuciusFile luciusFile
|
||||
[|addWidget $h >> addCassius $c >> addJulius $j >> addLucius $l|]
|
||||
where
|
||||
unlessExists tofn f = do
|
||||
whenExists tofn f = do
|
||||
e <- qRunIO $ doesFileExist $ tofn x
|
||||
if e then f x else [|mempty|]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user