{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreidmmholm5qdyspbs36bx4gub2nxcthrq7ghp37wbvh22synhvyhh4",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mivyy6kmuzl2"
  },
  "path": "/t/shader-pipeline-primshader-and-random-face-colours/13904#post_3",
  "publishedAt": "2026-04-07T11:34:11.000Z",
  "site": "https://discourse.haskell.org",
  "tags": [
    "@wiz"
  ],
  "textContent": "The difficulty I have with this is that I can only generate anything once - whether it’s a `StdGen` or `VertexColour`: my entry point is `canvasLoop :: IO ()` and I get one single `StdGen` via `initStdGen`.\n\nThe `primShader` is retrieved via the `getPrimShader`record accessor to the the overall `Shader` and is deeply embedded in the `objShaderPipeline` function. Therefore, whatever colour I set on `randomColourShader` is set and cannot be changed unless I can thread the new state through to subsequent calls effectively creating some kind of global state  or dependency chain where every call to `primShader` needs to know about any calls to other `primShader`.\n\n@wiz suggested making the `Shader` types some kind of `State` monad `Shader → (a, Shader)` so I’m going to try that?",
  "title": "Shader Pipeline: PrimShader and Random Face Colours"
}