-- The void function takes a functor and replaces its value with Unit.
-- In the example, it is used to make main conform with its signature.
main :: Effect Unit
main = void $ unsafePartial do
Just canvas <- getCanvasElementById "canvas"
ctx <- getContext2D canvas
main :: Effect Unit
main = unsafePartial do
Just canvas ← getCanvasElementById "canvas"
ctx ← getContext2D canvas
setFillStyle ctx "#00F"
fillPath ctx $ rect ctx
{ x: 250.0
, y: 250.0
, width: 300.0
, height: 100.0
}
void is not needed in this case b/c rect has already the desired result type:
fillPath :: ∀ a. Context2D → Effect a → Effect a
rect :: Context2D → Rectangle → Effect Unit
Similar in other examples. void is only needed in Example.LSystem.
voidis not needed in this case b/crecthas already the desired result type:Similar in other examples.
voidis only needed inExample.LSystem.