jfischoff/twitch

Simple example does not work as intended

menelaos opened this issue · 3 comments

If I compile the following code, run it with ./dist/build/myProgram/myProgram
and modify someFile.md in the current directory, the program outputs "foo" twice.

{-# LANGUAGE OverloadedStrings #-}
import Twitch 

main = defaultMain $ do
  "*.md"   |> \_ -> putStrLn "foo"

If I do the same with the following code,
the program does nothing.

{-# LANGUAGE OverloadedStrings #-}
import Twitch 

main = defaultMain $ do
  "*.md"   |> \_ -> putStrLn "foo"
  "*.html" |> \_ -> putStrLn "bar"

Is this a bug or am I missing something?

It turns out this is two separate issues.
The reason for firing twice in the first example is actually due to Vim which
writes to a new file and moves it when saving. This is therefore not twitch's
fault.

The second issue remains though:

instance Show Rule where
  show = name

dep1 = "*.md"   :: Dep
dep2 = "*.html" :: Dep

f = \_ -> putStrLn "foo"

dep1' = dep1 |+ f
dep2' = dep2 |+ f

runDep $ dep1  >> dep2      -- [*.html, *.md]
runDep $ dep1' >> dep2'     -- [*.html]

I see.

Fixed in 8e93ff5.