Content-Length: 291893 | pFad | http://github.com/purescript-halogen/purescript-halogen/pull/833

C1 Re: Hydration by srghma · Pull Request #833 · purescript-halogen/purescript-halogen · GitHub
Skip to content

Re: Hydration #833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Re: Hydration #833

wants to merge 4 commits into from

Conversation

srghma
Copy link
Contributor

@srghma srghma commented Apr 19, 2025

srghma added 3 commits April 19, 2025 19:16
…ched)

```purs
module Foo where

import Prelude

import Data.Tuple
import Effect.Uncurried as EFn

renderComponentSlot :: EFn.EffectFn1 String (Tuple Int (EFn.EffectFn2 Int Int Int))
renderComponentSlot = EFn.mkEffectFn1 \cs -> pure (Tuple 1 patch)

patch :: EFn.EffectFn2 Int Int Int
patch = EFn.mkEffectFn2 \st slot -> map fst $ EFn.runEffectFn1 renderComponentSlot ""
```

gives

```js
import * as Data_Functor from "../Data.Functor/index.js";
import * as Data_Tuple from "../Data.Tuple/index.js";
import * as Effect from "../Effect/index.js";
var $runtime_lazy = function (name, moduleName, init) {
    var state = 0;
    var val;
    return function (lineNumber) {
        if (state === 2) return val;
        if (state === 1) throw new ReferenceError(name + " was needed before it finished initializing (module " + moduleName + ", line " + lineNumber + ")", moduleName, lineNumber);
        state = 1;
        val = init();
        state = 2;
        return val;
    };
};
var map = /* #__PURE__ */ Data_Functor.map(Effect.functorEffect);
var $lazy_patch = /* #__PURE__ */ $runtime_lazy("patch", "Foo", function () {
    return function (st, slot) {
        return map(Data_Tuple.fst)(function () {
            return $lazy_renderComponentSlot(18)("");
        })();
    };
});
var $lazy_renderComponentSlot = /* #__PURE__ */ $runtime_lazy("renderComponentSlot", "Foo", function () {
    return function (cs) {
        var step = $lazy_patch(14);
        return new Data_Tuple.Tuple(1, step);
    };
});
var patch = /* #__PURE__ */ $lazy_patch(17);
var renderComponentSlot = /* #__PURE__ */ $lazy_renderComponentSlot(9);
export {
    renderComponentSlot,
    patch
};
```

but

```purs
module Foo where

import Prelude

import Data.Tuple
import Effect.Uncurried as EFn

renderComponentSlot :: EFn.EffectFn1 String (Tuple Int (EFn.EffectFn2 Int Int Int))
renderComponentSlot = EFn.mkEffectFn1 \cs -> pure (Tuple 1 patch)

x = EFn.runEffectFn1 renderComponentSlot ""

patch :: EFn.EffectFn2 Int Int Int
patch = EFn.mkEffectFn2 \st slot -> map fst $ x
```

throws
@srghma
Copy link
Contributor Author

srghma commented Apr 19, 2025

@garyb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/purescript-halogen/purescript-halogen/pull/833

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy