Skip to content

Instantly share code, notes, and snippets.

@ryantrinkle
Forked from et4te/Sample.hs
Last active October 7, 2015 21:37
Show Gist options
  • Save ryantrinkle/929338f682af85dc2172 to your computer and use it in GitHub Desktop.
Save ryantrinkle/929338f682af85dc2172 to your computer and use it in GitHub Desktop.
Here the updated baseImgD in templateRenderCanvas will not fire
templateRenderCanvas qrcInfoD cnvInfo newBaseImage initialBaseImage = do
cnvRef <- liftIO $ mkCanvas' cnvInfo
qrcInfo <- sample $ current qrcInfoD
imgRef <- liftIO $ canvasDisplay cnvRef imgInfo
qrcRef <- liftIO $ canvasDisplay cnvRef qrcInfo
liftIO $ canvasAddChild cnvRef imgRef
liftIO $ imageAddChild imgRef qrcRef
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
(firstBaseImg, laterBaseImgs) <- headTailE $ updated baseImgD
widgetHold (text "Please select a base image") $
fmap (templateRenderCanvas qrcImgD defaultCanvasInfo laterBaseImgs) firstBaseImg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment