Skip to content

Instantly share code, notes, and snippets.

@et4te
Created October 7, 2015 21:14
Show Gist options
  • Save et4te/e78564a409012d3c6d3c to your computer and use it in GitHub Desktop.
Save et4te/e78564a409012d3c6d3c to your computer and use it in GitHub Desktop.
Here the updated baseImgD in templateRenderCanvas will not fire
templateRenderImages cnvRef qrcInfoD imgInfo = do
qrcInfo <- sample $ current qrcInfoD
imgRef <- liftIO $ canvasDisplay cnvRef imgInfo
qrcRef <- liftIO $ canvasDisplay cnvRef qrcInfo
liftIO $ canvasAddChild cnvRef imgRef
liftIO $ imageAddChild imgRef qrcRef
templateRenderCanvas qrcInfoD baseImgD cnvRef = do
widgetHold (text "Creating base image ...") $ do
fmap (templateRenderImages cnvRef qrcInfoD) (updated baseImgD)
return ()
--templateCanvas :: (MonadWidget t m) => TemplateForm t -> m (TemplateCanvas t)
templateCanvas :: (MonadWidget t m) => TemplateForm t -> m ()
templateCanvas tf = do
baseImgD <- mkImageInfo (fileInfo tf) defaultImageInfo
qrcImgD <- mkQRImageInfo (updated baseImgD)
display baseImgD
display qrcImgD
-- Only ever fire cnvInfo once
let cnvInfoE = tag (constant defaultCanvasInfo) (updated baseImgD)
cnvRefE <- mkCanvas cnvInfoE
widgetHold (text "Creating canvas ...") $
fmap (templateRenderCanvas baseImgD qrcImgD) cnvRefE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment