~jack/misc

4161ae98a0bd95edcd9a8f48c5daf019dd7164bb — Jack Kelly 1 year, 2 months ago 91882d0
Add comment discussing fan of FS.Event
1 files changed, 7 insertions(+), 1 deletions(-)

M reflex-gl-demo/src/Shader.hs
M reflex-gl-demo/src/Shader.hs => reflex-gl-demo/src/Shader.hs +7 -1
@@ 113,7 113,13 @@ watchShaderProgram manager dir vsFileRel fsFileRel = do
  vsInitial <- liftIO $ B.readFile vsFileAbs
  fsInitial <- liftIO $ B.readFile fsFileAbs

  -- Watch the dir for changes to the files we're interested in
  -- Watch the dir for changes to the files we're interested in. In
  -- this demo program, we only care about one of the constructors of
  -- a 'FS.Event'. This means we can get away with
  -- 'mapMaybe'.
  --
  -- Exercise: Learn how to use 'fan' to efficiently split an 'Event t
  -- FS.Event' into four different 'Event's.
  let
    onlyModifications (FS.Modified path mtime isDir) = Just (path, mtime, isDir)
    onlyModifications _ = Nothing